From 4e067f5f2b4d83ebecb4bd189a7efe3634a8a55b Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 26 Apr 2015 10:46:38 +0300 Subject: [PATCH] Show level annotation on level entry Idea by Chris Smith, via Unnethack --- include/extern.h | 1 + src/do.c | 4 ++++ src/dungeon.c | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/include/extern.h b/include/extern.h index 821f2a41c..4bf8dbbf3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -570,6 +570,7 @@ E boolean FDECL(Invocation_lev, (d_level *)); E xchar NDECL(level_difficulty); E schar FDECL(lev_by_name, (const char *)); E schar FDECL(print_dungeon, (BOOLEAN_P,schar *,xchar *)); +E char *FDECL(get_annotation, (d_level *)); E int NDECL(donamelevel); E int NDECL(dooverview); E void FDECL(show_overview, (int,int)); diff --git a/src/do.c b/src/do.c index 97c11a8ef..3962e6d01 100644 --- a/src/do.c +++ b/src/do.c @@ -1069,6 +1069,7 @@ boolean at_stairs, falling, portal; boolean new = FALSE; /* made a new level? */ struct monst *mtmp; char whynot[BUFSZ]; + char *annotation; if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel)) newlevel->dlevel = dunlevs_in_dungeon(newlevel); @@ -1458,6 +1459,9 @@ boolean at_stairs, falling, portal; save_currentstate(); #endif + if ((annotation = get_annotation(&u.uz))) + You("remember this level as %s.", annotation); + /* assume this will always return TRUE when changing level */ (void) in_out_region(u.ux, u.uy); (void) pickup(1); diff --git a/src/dungeon.c b/src/dungeon.c index d02f3aec6..9a34aff0c 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1848,6 +1848,16 @@ d_level *dest; } } +char * +get_annotation(lev) +d_level *lev; +{ + mapseen *mptr; + if ((mptr = find_mapseen(lev))) + return mptr->custom; + return NULL; +} + /* #annotate command - add a custom name to the current level */ int donamelevel()