fix pull request #488 - regressions for 'a'pply

Restore some old behavior for the apply command that was changed
by the "getobj refactor" patch.  You couldn't attempt to apply
potions to determine whether they were oil, couldn't apply gray
stones once touchstone was discovered, and attempting to apply
arbitrary items gave "that is a silly thing to apply" rather
than "sorry, I don't know how to use that."
This commit is contained in:
PatR
2021-04-18 17:02:11 -07:00
parent 141cafb210
commit 221d82f899
3 changed files with 22 additions and 13 deletions

View File

@@ -614,6 +614,7 @@ give genetic engineers teleport capability (as they had in slash'em); 'port
away after polymorphing someone so that they don't just repeat that
if an invisible hero managed to convert an unaligned altar to an aligned one
with color enabled, altar wasn't immediately redrawn with new color
repair some regressions to (a)pply introduced by "getobj refactor" patch
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -500,13 +500,13 @@ enum getobj_callback_returns {
* else to foo". */
GETOBJ_EXCLUDE_INACCESS = -1,
/* invalid for purposes of not showing a prompt if nothing is valid but
* psuedo-valid for selecting - identical to GETOBJ_EXCLUDE but
* psuedo-valid for selecting - identical to GETOBJ_EXCLUDE_INACCESS but
* without the "else" in "You don't have anything else to foo". */
GETOBJ_EXCLUDE_SELECTABLE = 0,
/* valid - invlet not presented in the summary or the ? menu as a
* recommendation, but is selectable if the player enters it anyway. Used
* for objects that are actually valid but unimportantly so, such as shirts
* for reading. */
* recommendation, but is selectable if the player enters it anyway.
* Used for objects that are actually valid but unimportantly so, such
* as shirts for reading. */
GETOBJ_DOWNPLAY = 1,
/* valid - will be shown in summary and ? menu */
GETOBJ_SUGGEST = 2,

View File

@@ -3658,7 +3658,7 @@ apply_ok(struct obj *obj)
return GETOBJ_EXCLUDE;
/* all tools, all wands (breaking), all spellbooks (flipping through -
* including blank/novel/Book of the Dead) */
including blank/novel/Book of the Dead) */
if (obj->oclass == TOOL_CLASS || obj->oclass == WAND_CLASS
|| obj->oclass == SPBOOK_CLASS)
return GETOBJ_SUGGEST;
@@ -3669,11 +3669,16 @@ apply_ok(struct obj *obj)
|| obj->otyp == BULLWHIP))
return GETOBJ_SUGGEST;
/* only applicable potion is oil, and it will only be offered as a choice
* when already discovered */
if (obj->otyp == POT_OIL && obj->dknown
&& objects[obj->otyp].oc_name_known)
return GETOBJ_SUGGEST;
if (obj->oclass == POTION_CLASS) {
/* permit applying unknown potions, but don't suggest them */
if (!obj->dknown || !objects[obj->otyp].oc_name_known)
return GETOBJ_DOWNPLAY;
/* only applicable potion is oil, and it will only be suggested as a
choice when already discovered */
if (obj->otyp == POT_OIL)
return GETOBJ_SUGGEST;
}
/* certain foods */
if (obj->otyp == CREAM_PIE || obj->otyp == EUCALYPTUS_LEAF
@@ -3682,19 +3687,22 @@ apply_ok(struct obj *obj)
if (is_graystone(obj)) {
/* The only case where we don't suggest a gray stone is if we KNOW it
* isn't a touchstone. */
isn't a touchstone. */
if (!obj->dknown)
return GETOBJ_SUGGEST;
if (obj->otyp != TOUCHSTONE
&& (objects[TOUCHSTONE].oc_name_known
|| objects[obj->otyp].oc_name_known))
return GETOBJ_EXCLUDE;
return GETOBJ_EXCLUDE_SELECTABLE;
return GETOBJ_SUGGEST;
}
return GETOBJ_EXCLUDE;
/* item can't be applied; if picked anyway,
_EXCLUDE would yield "That is a silly thing to apply.",
_EXCLUDE_SELECTABLE yields "Sorry, I don't know how to use that." */
return GETOBJ_EXCLUDE_SELECTABLE;
}
/* the 'a' command */