From 387cef9899a8239bc8cd5be0a80dfbbc2241172b Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 17 Nov 2023 00:36:43 -0800 Subject: [PATCH] 'm #overview' enhancement When using the 'm' prefix with #overview to get a menu of visited levels and then picking one to annotate, replace the generic prompt "what do you want to call this dungeon level?" with more specific location information. Location details are visible while within the menu but as soon as you choose something that goes away. --- doc/fixes3-7-0.txt | 3 +++ src/dungeon.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 0f1e1c4a0..513d975d9 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1743,6 +1743,9 @@ if recoil from throwing an item while levitating sent hero into a wall of include '-' as suggested item in "what to dip?" prompt if dipping at pool or fountain or sink with slippery hands don't attempt a second hit for bare handed/martial arts if wearing a shield +when using 'm #overview' to annotate a level other than current the one, + include level number, and dungeon branch if not current one, in the + prompt instead of generic "this level" Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/src/dungeon.c b/src/dungeon.c index 3495c8e1b..52e04329a 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -2650,7 +2650,29 @@ query_annotation(d_level *lev) getlin(tmpbuf, nbuf); } else #endif - getlin("What do you want to call this dungeon level?", nbuf); + { + char qbuf[QBUFSZ], lbuf[QBUFSZ]; /* level description */ + + if (!lev || on_level(&u.uz, lev)) { + Strcpy(lbuf, "this dungeon level"); + } else { + int dflgs = (lev->dnum == u.uz.dnum) ? 0 : 2; + d_level save_uz = u.uz; + + u.uz = *lev; + (void) describe_level(lbuf, dflgs); + u.uz = save_uz; + + (void) strsubst(lbuf, "Dlvl:", "level "); + /* even though we've told describe_level() not to append + a trailing space (by not including '1' in dflgs), the + level number is formatted with %-2d so single digit + values will end up with one anyway; remove it */ + (void) trimspaces(lbuf); + } + Snprintf(qbuf, sizeof qbuf, "What do you want to call %s?", lbuf); + getlin(qbuf, nbuf); + } /* empty input or ESC means don't add or change annotation; space-only means discard current annotation without adding new one */