fix for 'R' on armor ignoring 'T's restrictions

Reported directly to devteam, the 'R' command would let you take off
a suit from under a cloak or a shirt from under a suit and/or a cloak,
and it didn't require any extra turns.  'T' doesn't allow either of
those.  ('A' lets you take off a suit from under a cloak, adding in
extra turns to implicitly take the cloak off and put it back on,
but doesn't allow the same for shirt.)

'R' also let you attempt to take off embedded dragon scales if you
were wearing 2 or more accessories (or just 1 with paranoid_confirm
set for takeoff/remove), which triggered impossible "select_off:
<scales object> (embedded in skin)???".
This commit is contained in:
PatR
2016-02-16 16:06:02 -08:00
parent 8d2a74b5b0
commit f5a39c0596
2 changed files with 25 additions and 20 deletions

View File

@@ -157,6 +157,9 @@ issues with Warning when you're adjacent to an undetected hider; clearly you
are aware a monster is present so this causes you to search it out
allow lookup of names like Hachi when selecting monsters from the map
lookup "More Info?" prompt will now tell you what it will look for on 'y'
using 'R' on armor would bypass some restrictions imposed by 'T' (inner layer
could be taken off from under outer layer, embedded scales could be
attempted but triggered "select_off" impossible)
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1446975698 2015/11/08 09:41:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1455667557 2016/02/17 00:05:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.90 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1380,6 +1380,27 @@ struct obj *obj;
You("are not wearing that.");
return 0;
}
if (obj == uskin
|| ((obj == uarm) && uarmc)
|| ((obj == uarmu) && (uarmc || uarm))) {
char why[QBUFSZ], what[QBUFSZ];
why[0] = what[0] = '\0';
if (obj != uskin) {
if (uarmc)
Strcat(what, cloak_simple_name(uarmc));
if ((obj == uarmu) && uarm) {
if (uarmc)
Strcat(what, " and ");
Strcat(what, suit_simple_name(uarm));
}
Sprintf(why, " without taking off your %s first", what);
} else {
Strcpy(why, "; it's embedded");
}
You_cant("take that off%s.", why);
return 0;
}
reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
(void) select_off(obj);
@@ -1434,25 +1455,6 @@ dotakeoff()
otmp = getobj(clothes, "take off");
if (!otmp)
return 0;
if (otmp == uskin
|| ((otmp == uarm) && uarmc)
|| ((otmp == uarmu) && (uarmc || uarm))) {
char why[BUFSZ], what[BUFSZ];
why[0] = what[0] = '\0';
if (otmp != uskin) {
if (uarmc)
Strcat(what, cloak_simple_name(uarmc));
if ((otmp == uarmu) && uarm) {
if (uarmc)
Strcat(what, " and ");
Strcat(what, suit_simple_name(uarm));
}
Sprintf(why, " without taking off your %s first", what);
}
You_cant("take that off%s.", why);
return 0;
}
return armor_or_accessory_off(otmp);
}