From da40f55a9ff3e264488c11a67e14018e90676f09 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 30 Dec 2018 15:30:38 -0800 Subject: [PATCH] 'O' vs bouldersym The 'O' handling for bouldersym was updating the display value for boulder even if the value had been rejected, and if it still had the default of '\0', the map would end up with characters. (When examined via '//' or ';', those matched dummy monster class #0 and led to the impossible "Alphabet soup: 'an("")'" that was suppressed yesterday.) Attempting to set bouldersym to ^@ or \0 would also be rejected as duplicating a monster symbol. That is now accepted and used to reset the boulder symbol to default. However, other control characters are also accepted--not due to this patch, they already are, and from a config file in addition to via 'O'--so bouldersym can still disrupt the map. But that's no different from putting control characters into a symbol set or setting them from config file via S_foo:^C. --- doc/fixes36.2 | 5 ++++- include/display.h | 4 +++- src/drawing.c | 12 ++++++++---- src/options.c | 28 ++++++++++++++++------------ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 1f858d9a9..fe8568a2d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.218 $ $NHDT-Date: 1546144745 2018/12/30 04:39:05 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.219 $ $NHDT-Date: 1546212616 2018/12/30 23:30:16 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -319,6 +319,9 @@ when merging a stack where internal ID is used to adjust shop prices, always from shop, not when selling; doesn't affect items already on bill) since knives became stackable in 3.6.0, fake player monsters could be given multi-quantity stacks for weapons (scalpel, athame) they never throw +using 'O' to attempt to set bouldersym to a monster letter or warning digit + while it still had its default value would override the display value + for it to be ('\0') after 'badoption' feedback Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/display.h b/include/display.h index a07b53634..1334be2cc 100644 --- a/include/display.h +++ b/include/display.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 display.h $NHDT-Date: 1525012585 2018/04/29 14:36:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */ +/* NetHack 3.6 display.h $NHDT-Date: 1546212620 2018/12/30 23:30:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.29 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -257,6 +257,8 @@ * * warning A set of six representing the different warning levels. * + * statue One for each monster. Count: NUMMONS + * * The following are offsets used to convert to and from a glyph. */ #define NUM_ZAP 8 /* number of zap beam types */ diff --git a/src/drawing.c b/src/drawing.c index e9dd2481d..ec11bb843 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 drawing.c $NHDT-Date: 1463706747 2016/05/20 01:12:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.51 $ */ +/* NetHack 3.6 drawing.c $NHDT-Date: 1546212616 2018/12/30 23:30:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.58 $ */ /* Copyright (c) NetHack Development Team 1992. */ /* NetHack may be freely redistributed. See license for details. */ @@ -357,9 +357,13 @@ init_symbols() void update_bouldersym() { - showsyms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym; - l_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym; - r_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym; + nhsym boulder = (nhsym) iflags.bouldersym; + + if (!boulder) + boulder = def_oc_syms[ROCK_CLASS].sym; /* (nhsym) ROCK_SYM */ + showsyms[SYM_BOULDER + SYM_OFF_X] = boulder; + l_syms[SYM_BOULDER + SYM_OFF_X] = boulder; + r_syms[SYM_BOULDER + SYM_OFF_X] = boulder; } void diff --git a/src/options.c b/src/options.c index 564abf833..ef440e855 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1546144857 2018/12/30 04:40:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.349 $ */ +/* NetHack 3.6 options.c $NHDT-Date: 1546212618 2018/12/30 23:30:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.350 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2724,27 +2724,31 @@ boolean tinitial, tfrom_file; if (!(opts = string_for_opt(opts, FALSE))) return FALSE; escapes(opts, opts); + /* note: dummy monclass #0 has symbol value '\0'; we allow that-- + attempting to set bouldersym to '^@'/'\0' will reset to default */ if (def_char_to_monclass(opts[0]) != MAXMCLASSES) - clash = 1; - else if (opts[0] >= '1' && opts[0] <= '5') + clash = opts[0] ? 1 : 0; + else if (opts[0] >= '1' && opts[0] < WARNCOUNT + '0') clash = 2; if (clash) { /* symbol chosen matches a used monster or warning - symbol which is not good - reject it*/ + symbol which is not good - reject it */ config_error_add( - "Badoption - boulder symbol '%c' conflicts with a %s symbol.", - opts[0], (clash == 1) ? "monster" : "warning"); + "Badoption - boulder symbol '%s' would conflict with a %s symbol", + visctrl(opts[0]), + (clash == 1) ? "monster" : "warning"); } else { /* * Override the default boulder symbol. */ iflags.bouldersym = (uchar) opts[0]; - } - /* for 'initial', update_bouldersym() is done in initoptions_finish(), - after all symset options have been processed */ - if (!initial) { - update_bouldersym(); - need_redraw = TRUE; + /* for 'initial', update_bouldersym() is done in + initoptions_finish(), after all symset options + have been processed */ + if (!initial) { + update_bouldersym(); + need_redraw = TRUE; + } } return retval; #else -- 2.40.0