From 1273d6817e18502180a71d521efa7214c9d670c6 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 27 Oct 2018 03:45:18 -0700 Subject: [PATCH] provide dungeon location in ^X feedback Dungeon level wasn't included in ^X output, so it wasn't actually giving all status fields and attempting to rely on it when turning off 'status_updates' was leaving a gap in feedback for the player. Add an extra line to the first section where character's name and patron deity are reported, giving current location. |You are in the Dungeons of Doom, on level 5. or |You are in the endgame, on the Elemental Plane of Fire. The information is more explicit than the basic status field, but you can already get similar information via #overview so it isn't giving away extra info. --- doc/fixes36.2 | 2 ++ include/extern.h | 2 ++ src/cmd.c | 35 +++++++++++++++++++++++++++++++++++ src/dungeon.c | 3 +-- src/topten.c | 3 +-- 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index b9d04e360..f8e4c8b11 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -174,6 +174,8 @@ in Guidebook.mn and Guidebook.txt, the 'I' command mis-described `IX' as poison gas (stinking cloud) wasn't shown at drawbridge-up spot prayer result which enhanced strength (fix weakness from hunger) didn't give a message if a change in encumbrance occurred; it came on next move +add current location within the dungeon to the Background section of ^X and + final disclosure (it's not background but doesn't fit anywhere else) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 27699c8bf..4a3e1b610 100644 --- a/include/extern.h +++ b/include/extern.h @@ -628,6 +628,7 @@ E void FDECL(room_discovered, (int)); E void FDECL(recbranch_mapseen, (d_level *, d_level *)); E void FDECL(overview_stats, (winid, const char *, long *, long *)); E void FDECL(remdun_mapseen, (int)); +E const char *FDECL(endgamelevelname, (char *, int)); /* ### eat.c ### */ @@ -2417,6 +2418,7 @@ E void NDECL(timer_sanity_check); /* ### topten.c ### */ E void FDECL(formatkiller, (char *, unsigned, int, BOOLEAN_P)); +E int FDECL(observable_depth, (d_level *)); E void FDECL(topten, (int, time_t)); E void FDECL(prscore, (int, char **)); E struct toptenentry *NDECL(get_rnd_toptenentry); diff --git a/src/cmd.c b/src/cmd.c index 34d3ee19a..f88247ec7 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1833,6 +1833,41 @@ int final; difalgn ? align_str(u.ualignbase[A_ORIGINAL]) : ""); putstr(en_win, 0, buf); } + + /* 3.6.2: dungeon level, so that ^X really has all status info as + claimed by the comment below; this reveals more information than + the basic status display, but that's one of the purposes of ^X; + similar information is revealed by #overview; the "You died in + " given by really_done() is more rudimentary than this */ + *buf = *tmpbuf = '\0'; + if (In_endgame(&u.uz)) { + int egdepth = observable_depth(&u.uz); + + (void) endgamelevelname(tmpbuf, egdepth); + Sprintf(buf, "in the endgame, on the %s%s", + !strncmp(tmpbuf, "Plane", 5) ? "Elemental " : "", tmpbuf); + } else if (Is_knox(&u.uz)) { + /* this gives away the fact that the knox branch is only 1 level */ + Sprintf(buf, "on the %s level", dungeons[u.uz.dnum].dname); + /* TODO? maybe phrase it differently when actually inside the fort, + if we're able to determine that (not trivial) */ + } else { + char dgnbuf[QBUFSZ]; + + Strcpy(dgnbuf, dungeons[u.uz.dnum].dname); + if (!strncmpi(dgnbuf, "The ", 4)) + *dgnbuf = lowc(*dgnbuf); + Sprintf(tmpbuf, "level %d", + In_quest(&u.uz) ? dunlev(&u.uz) : depth(&u.uz)); + /* TODO? maybe extend this bit to include various other automatic + annotations from the dungeon overview code */ + if (Is_rogue_level(&u.uz)) + Strcat(tmpbuf, ", a primitive area"); + else if (Is_bigroom(&u.uz) && !Blind) + Strcat(tmpbuf, ", a very big room"); + Sprintf(buf, "in %s, on %s", dgnbuf, tmpbuf); + } + you_are(buf, ""); } /* characteristics: expanded version of bottom line strength, dexterity, &c; diff --git a/src/dungeon.c b/src/dungeon.c index 8dbccd974..335ca15da 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -71,7 +71,6 @@ STATIC_DCL void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid, int, int, int *)); STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *)); STATIC_DCL const char *FDECL(br_string2, (branch *)); -STATIC_DCL const char *FDECL(endgamelevelname, (char *, int)); STATIC_DCL const char *FDECL(shop_string, (int)); STATIC_DCL char *FDECL(tunesuffix, (mapseen *, char *)); @@ -2775,7 +2774,7 @@ branch *br; } /* get the name of an endgame level; topten.c does something similar */ -STATIC_OVL const char * +const char * endgamelevelname(outbuf, indx) char *outbuf; int indx; diff --git a/src/topten.c b/src/topten.c index 4652d42b2..6a226df3f 100644 --- a/src/topten.c +++ b/src/topten.c @@ -62,7 +62,6 @@ struct toptenentry { STATIC_DCL void FDECL(topten_print, (const char *)); STATIC_DCL void FDECL(topten_print_bold, (const char *)); -STATIC_DCL xchar FDECL(observable_depth, (d_level *)); STATIC_DCL void NDECL(outheader); STATIC_DCL void FDECL(outentry, (int, struct toptenentry *, BOOLEAN_P)); STATIC_DCL void FDECL(discardexcess, (FILE *)); @@ -178,7 +177,7 @@ const char *x; putstr(toptenwin, ATR_BOLD, x); } -STATIC_OVL xchar +int observable_depth(lev) d_level *lev; {