From 423cf77a37c771a09d43495140cefd96b2934da9 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 4 Feb 2019 18:40:55 -0800 Subject: [PATCH 1/2] more message history Noticed while investigating the issue with DECgraphics characters in msg_window:full/combination/reverse output for tty which got fixed by the previous commit. There was a discrepancy in DUMPLOG because the pager code bypasses pline() in order to use putmixed(). tty puts strings from the latter into ^P recall history (although they'll only render correctly if nothing after the first character needs special handling), but nothing was putting that same info into DUMPLOG. This fix is pretty clumsy but eliminates the discrepancy. --- doc/fixes36.2 | 5 ++++- src/pager.c | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index a5c243912..159e58cfb 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.248 $ $NHDT-Date: 1549333449 2019/02/05 02:24:09 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.249 $ $NHDT-Date: 1549334449 2019/02/05 02:40:49 $ 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, @@ -365,6 +365,9 @@ teleporting out a vault after guard appears could result in the guard being if game ends while hero is in a vault wall breach or in guard's temporary corridor, a message "you are encased in the rock" could be given when guard repairs things (for possible bones); suppress it if hero is dead +DUMPLOG: output from '/' (#whatis) and ';' went into ^P message recall history + but was missing from DUMPLOG's message history due to special handling + for the first character which might be graphical rather than text Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/pager.c b/src/pager.c index 775eabbc9..872c1ac5a 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1546656415 2019/01/05 02:46:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.147 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1549334449 2019/02/05 02:40:49 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.150 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1242,6 +1242,21 @@ coord *click_cc; if (found) { /* use putmixed() because there may be an encoded glyph present */ putmixed(WIN_MESSAGE, 0, out_str); +#ifdef DUMPLOG + { + char dmpbuf[BUFSZ]; + + /* putmixed() bypasses pline() so doesn't write to DUMPLOG; + tty puts it into ^P recall, so it ought to be there; + DUMPLOG is plain text, so override graphics character; + at present, force space, but we ought to use defsyms[] + value for the glyph the graphics character came from */ + (void) decode_mixed(dmpbuf, out_str); + if (dmpbuf[0] < ' ' || dmpbuf[0] >= 127) /* ASCII isprint() */ + dmpbuf[0] = ' '; + dumplogmsg(dmpbuf); + } +#endif /* check the data file for information about this thing */ if (found == 1 && ans != LOOK_QUICK && ans != LOOK_ONCE From 8c1e499f8b3df2317bd86ff8a56726bd50c8655f Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 5 Feb 2019 14:49:43 -0800 Subject: [PATCH 2/2] armor comments I don't see the #H8124 bug getting fixed any time soon, so add a comment about it since the relevant place is unambiguous. No change in code except removing a couple instances of 'register'. --- src/do_wear.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/do_wear.c b/src/do_wear.c index 8300bd0c2..843a1b084 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_wear.c $NHDT-Date: 1543745354 2018/12/02 10:09:14 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.103 $ */ +/* NetHack 3.6 do_wear.c $NHDT-Date: 1549406868 2019/02/05 22:47:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.104 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -572,7 +572,9 @@ STATIC_PTR int Shield_on(VOID_ARGS) { /* no shield currently requires special handling when put on, but we - keep this uncommented in case somebody adds a new one which does */ + keep this uncommented in case somebody adds a new one which does + [reflection is handled by setting u.uprops[REFLECTION].extrinsic + in setworn() called by armor_or_accessory_on() before Shield_on()] */ switch (uarms->otyp) { case SMALL_SHIELD: case ELVEN_SHIELD: @@ -648,14 +650,15 @@ Shirt_off(VOID_ARGS) return 0; } -/* This must be done in worn.c, because one of the possible intrinsics - * conferred is fire resistance, and we have to immediately set - * HFire_resistance in worn.c since worn.c will check it before returning. - */ STATIC_PTR int Armor_on(VOID_ARGS) { + /* + * No suits require special handling. Special properties conferred by + * suits are set up as intrinsics (actually 'extrinsics') by setworn() + * which is called by armor_or_accessory_on() before Armor_on(). + */ return 0; } @@ -669,7 +672,10 @@ Armor_off(VOID_ARGS) } /* The gone functions differ from the off functions in that if you die from - * taking it off and have life saving, you still die. + * taking it off and have life saving, you still die. [Obsolete reference + * to lack of fire resistance being fatal in hell (nethack 3.0) and life + * saving putting a removed item back on to prevent that from immediately + * repeating.] */ int Armor_gone() @@ -920,7 +926,7 @@ register struct obj *obj; goto adjust_attrib; case RIN_ADORNMENT: which = A_CHA; - adjust_attrib: + adjust_attrib: old_attrib = ACURR(which); ABON(which) += obj->spe; observable = (old_attrib != ACURR(which)); @@ -1034,7 +1040,7 @@ boolean gone; goto adjust_attrib; case RIN_ADORNMENT: which = A_CHA; - adjust_attrib: + adjust_attrib: old_attrib = ACURR(which); ABON(which) -= obj->spe; observable = (old_attrib != ACURR(which)); @@ -1082,7 +1088,7 @@ struct obj *obj; void Blindf_on(otmp) -register struct obj *otmp; +struct obj *otmp; { boolean already_blind = Blind, changed = FALSE; @@ -1118,7 +1124,7 @@ register struct obj *otmp; void Blindf_off(otmp) -register struct obj *otmp; +struct obj *otmp; { boolean was_blind = Blind, changed = FALSE; @@ -1902,8 +1908,21 @@ struct obj *obj; if (armor) { int delay; + /* + * FIXME: [#H8124] + * This (setting 'obj->known=1') takes places as soon as hero + * starts donning armor and sticks even if interrupted before + * finishing. (Most glaring instance is theft of this armor + * by a nymph but any interruption applies.) + * + * Perhaps setworn() (the reason to set obj->known=1) should + * be deferred until the (*aftermv)() action? But Boots_on()/ + * Helmet_on()/&c aren't passed this 'obj', they rely to uarmf/ + * uarmh/&c being assigned by setworn() before they're called. + */ obj->known = 1; /* since AC is shown on the status line */ - /* if the armor is wielded, release it for wearing */ + /* if the armor is wielded, release it for wearing (won't be + welded even if cursed; that only happens for weapons/weptools) */ if (obj->owornmask & W_WEAPON) remove_worn_item(obj, FALSE); setworn(obj, mask);