From 2db7e201161dc646c611551a527c0314c283e58b Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 16 Sep 2017 23:49:28 +0300 Subject: [PATCH] Fix invisible gold symbol in status lines --- doc/fixes36.1 | 1 + include/extern.h | 1 + include/flag.h | 1 + src/botl.c | 13 ++++++++++++- src/do.c | 1 + src/options.c | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index e060fc053..7379669ab 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -438,6 +438,7 @@ if was possible to leash an adjacent pet while engulfed if leash or unleash attempt was directed at "remembered, unseen monster" glyph and yielded "there's no creature there", the glyph wasn't removed wizmode level teleport menu indicates on what level you currently are +fix invisible gold symbol in status line when S_coin was set to space Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 11ac0e4c1..f5e6ec9de 100644 --- a/include/extern.h +++ b/include/extern.h @@ -142,6 +142,7 @@ E int NDECL(getbones); /* ### botl.c ### */ E char *NDECL(do_statusline1); +E void NDECL(check_gold_symbol); E char *NDECL(do_statusline2); E int FDECL(xlev_to_rank, (int)); E int FDECL(title_to_mon, (const char *, int *, int *)); diff --git a/include/flag.h b/include/flag.h index 4cd9e1641..1a3ef3577 100644 --- a/include/flag.h +++ b/include/flag.h @@ -191,6 +191,7 @@ struct instance_flags { * behaviour of various NetHack functions and probably warrant * a structure of their own elsewhere some day. */ + boolean invis_goldsym; /* gold symbol is ' '? */ int parse_config_file_src; /* hack for parse_config_line() */ int in_lava_effects; /* hack for Boots_off() */ int last_msg; /* indicator of last message player saw */ diff --git a/src/botl.c b/src/botl.c index e28e8cc8b..d1d0a53e8 100644 --- a/src/botl.c +++ b/src/botl.c @@ -83,6 +83,16 @@ do_statusline1() return newbot1; } +void +check_gold_symbol() +{ + int goldch, goldoc; + unsigned int goldos; + int goldglyph = objnum_to_glyph(GOLD_PIECE); + (void) mapglyph(goldglyph, &goldch, &goldoc, &goldos, 0, 0); + iflags.invis_goldsym = ((char)goldch <= ' '); +} + char * do_statusline2() { @@ -110,7 +120,8 @@ do_statusline2() if ((money = money_cnt(invent)) < 0L) money = 0L; /* ought to issue impossible() and then discard gold */ Sprintf(eos(dloc), "%s:%-2ld", /* strongest hero can lift ~300000 gold */ - iflags.in_dumplog ? "$" : encglyph(objnum_to_glyph(GOLD_PIECE)), + (iflags.in_dumplog || iflags.invis_goldsym) ? "$" + : encglyph(objnum_to_glyph(GOLD_PIECE)), min(money, 999999L)); dln = strlen(dloc); /* '$' encoded as \GXXXXNNNN is 9 chars longer than display will need */ diff --git a/src/do.c b/src/do.c index 9fdece91f..fe27e7973 100644 --- a/src/do.c +++ b/src/do.c @@ -1254,6 +1254,7 @@ boolean at_stairs, falling, portal; #ifdef USE_TILES substitute_tiles(newlevel); #endif + check_gold_symbol(); /* record this level transition as a potential seen branch unless using * some non-standard means of transportation (level teleport). */ diff --git a/src/options.c b/src/options.c index 2c83c4af3..827e885ca 100644 --- a/src/options.c +++ b/src/options.c @@ -3651,6 +3651,7 @@ boolean tinitial, tfrom_file; /* Is it a symbol? */ if (strstr(opts, "S_") == opts && parsesymbols(opts)) { switch_symbols(TRUE); + check_gold_symbol(); return retval; } @@ -4152,6 +4153,7 @@ doset() /* changing options via menu by Per Liboriussen */ destroy_nhwindow(tmpwin); if (need_redraw) { + check_gold_symbol(); reglyph_darkroom(); (void) doredraw(); } -- 2.40.0