fix #H8124 - interrupted donning gives player info

about the armor.  Wearing armor sets obj->known, making its enchantment
be shown when it gets formatted, because the AC value on the status line
lets the player deduce what that is.  It was being set at the beginning
of the wear operation.  If the armor got stolen before it became fully
worn, the enchantment was still shown.  Defer that until the end of the
operation.  An attentive player can still deduce the enchantment if the
item is stolen (because its protection starts immediately) but the hero
won't learn that enchantment unless the donning completes.

This might be suboptimal but it isn't qualitatively different from
watching a pet walk/not-walk over items whose bless/curse state isn't
known or dropping unidentified items in a shop to check their price.
The player can deduce something that the hero doesn't know yet.
This commit is contained in:
PatR
2019-02-09 16:07:18 -08:00
parent 2d62513b1b
commit 128d1628a9
2 changed files with 22 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.252 $ $NHDT-Date: 1549666475 2019/02/08 22:54:35 $
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.253 $ $NHDT-Date: 1549757225 2019/02/10 00:07:05 $
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,
@@ -368,6 +368,9 @@ if game ends while hero is in a vault wall breach or in guard's temporary
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
when donning armor, defer flagging its +/- value--which can be deduced from
the status line--as known until finished in case it gets stolen before
then (player might still deduce the +/- value but hero won't learn it)
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* 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 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1549757226 2019/02/10 00:07:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.105 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -197,6 +197,7 @@ Boots_on(VOID_ARGS)
default:
impossible(unknown_type, c_boots, uarmf->otyp);
}
uarmf->known = 1; /* boots' +/- evident because of status line AC */
return 0;
}
@@ -310,6 +311,7 @@ Cloak_on(VOID_ARGS)
default:
impossible(unknown_type, c_cloak, uarmc->otyp);
}
uarmc->known = 1; /* cloak's +/- evident because of status line AC */
return 0;
}
@@ -425,6 +427,7 @@ Helmet_on(VOID_ARGS)
default:
impossible(unknown_type, c_helmet, uarmh->otyp);
}
uarmh->known = 1; /* helmet's +/- evident because of status line AC */
return 0;
}
@@ -497,6 +500,7 @@ Gloves_on(VOID_ARGS)
default:
impossible(unknown_type, c_gloves, uarmg->otyp);
}
uarmg->known = 1; /* gloves' +/- evident because of status line AC */
return 0;
}
@@ -587,7 +591,7 @@ Shield_on(VOID_ARGS)
default:
impossible(unknown_type, c_shield, uarms->otyp);
}
uarms->known = 1; /* shield's +/- evident because of status line AC */
return 0;
}
@@ -627,7 +631,7 @@ Shirt_on(VOID_ARGS)
default:
impossible(unknown_type, c_shirt, uarmu->otyp);
}
uarmu->known = 1; /* shirt's +/- evident because of status line AC */
return 0;
}
@@ -659,6 +663,7 @@ Armor_on(VOID_ARGS)
* suits are set up as intrinsics (actually 'extrinsics') by setworn()
* which is called by armor_or_accessory_on() before Armor_on().
*/
uarm->known = 1; /* suit's +/- evident because of status line AC */
return 0;
}
@@ -1908,23 +1913,20 @@ 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 (won't be
welded even if cursed; that only happens for weapons/weptools) */
if (obj->owornmask & W_WEAPON)
remove_worn_item(obj, FALSE);
/*
* Setting obj->known=1 is done because setworn() causes hero's AC
* to change so armor's +/- value is evident via the status line.
* We used to set it here because of that, but then it would stick
* if a nymph stole the armor before it was fully worn. Delay it
* until the aftermv action. The player may still know this armor's
* +/- amount if donning gets interruptted, but the hero won't.
*
obj->known = 1;
*/
setworn(obj, mask);
delay = -objects[obj->otyp].oc_delay;
if (delay) {