wishing bit

Allow wishing for "cookie" or "pie" to succeed since we have items
those can match.

Unrelated:  allow ^G of "genie" for similar reason.
This commit is contained in:
PatR
2018-10-19 01:47:29 -07:00
parent 327336ff01
commit f25f92c271
2 changed files with 16 additions and 6 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mondata.c $NHDT-Date: 1508479720 2017/10/20 06:08:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.63 $ */ /* NetHack 3.6 mondata.c $NHDT-Date: 1539938825 2018/10/19 08:47:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -740,7 +740,9 @@ const char *in_str;
{ "invisible stalker", PM_STALKER }, { "invisible stalker", PM_STALKER },
{ "high-elf", PM_ELVENKING }, /* PM_HIGH_ELF is obsolete */ { "high-elf", PM_ELVENKING }, /* PM_HIGH_ELF is obsolete */
{ "halfling", PM_HOBBIT }, /* potential guess for polyself */ { "halfling", PM_HOBBIT }, /* potential guess for polyself */
/* Hyphenated names */ { "genie", PM_DJINNI }, /* potential guess for ^G/#wizgenesis */
/* Hyphenated names -- it would be nice to handle these via
fuzzymatch() but it isn't able to ignore trailing stuff */
{ "ki rin", PM_KI_RIN }, { "ki rin", PM_KI_RIN },
{ "uruk hai", PM_URUK_HAI }, { "uruk hai", PM_URUK_HAI },
{ "orc captain", PM_ORC_CAPTAIN }, { "orc captain", PM_ORC_CAPTAIN },
+12 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1537659941 2018/09/22 23:45:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.212 $ */ /* NetHack 3.6 objnam.c $NHDT-Date: 1539938837 2018/10/19 08:47:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.214 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2398,7 +2398,13 @@ const char *oldstr;
if (p >= bp + 2 && lowc(p[-2]) == 'e') { if (p >= bp + 2 && lowc(p[-2]) == 'e') {
if (p >= bp + 3 && lowc(p[-3]) == 'i') { /* "ies" */ if (p >= bp + 3 && lowc(p[-3]) == 'i') { /* "ies" */
if (!BSTRCMPI(bp, p - 7, "cookies") if (!BSTRCMPI(bp, p - 7, "cookies")
|| !BSTRCMPI(bp, p - 4, "pies") || (!BSTRCMPI(bp, p - 4, "pies")
/* avoid false match for "harpies" */
&& (p - 4 == bp || p[-5] == ' '))
/* alternate djinni/djinn spelling; not really needed */
|| (!BSTRCMPI(bp, p - 6, "genies")
/* avoid false match for "progenies" */
&& (p - 6 == bp || p[-7] == ' '))
|| !BSTRCMPI(bp, p - 5, "mbies") /* zombie */ || !BSTRCMPI(bp, p - 5, "mbies") /* zombie */
|| !BSTRCMPI(bp, p - 5, "yries")) /* valkyrie */ || !BSTRCMPI(bp, p - 5, "yries")) /* valkyrie */
goto mins; goto mins;
@@ -2648,7 +2654,7 @@ STATIC_OVL NEARDATA const struct o_range o_ranges[] = {
absence of spaces and/or hyphens (such as "pickaxe" vs "pick axe" absence of spaces and/or hyphens (such as "pickaxe" vs "pick axe"
vs "pick-axe") then there is no need for inclusion in this list; vs "pick-axe") then there is no need for inclusion in this list;
likewise for ``"of" inversions'' ("boots of speed" vs "speed boots") */ likewise for ``"of" inversions'' ("boots of speed" vs "speed boots") */
struct alt_spellings { static const struct alt_spellings {
const char *sp; const char *sp;
int ob; int ob;
} spellings[] = { } spellings[] = {
@@ -2673,6 +2679,8 @@ struct alt_spellings {
{ "eucalyptus", EUCALYPTUS_LEAF }, { "eucalyptus", EUCALYPTUS_LEAF },
{ "royal jelly", LUMP_OF_ROYAL_JELLY }, { "royal jelly", LUMP_OF_ROYAL_JELLY },
{ "lembas", LEMBAS_WAFER }, { "lembas", LEMBAS_WAFER },
{ "cookie", FORTUNE_COOKIE },
{ "pie", CREAM_PIE },
{ "marker", MAGIC_MARKER }, { "marker", MAGIC_MARKER },
{ "hook", GRAPPLING_HOOK }, { "hook", GRAPPLING_HOOK },
{ "grappling iron", GRAPPLING_HOOK }, { "grappling iron", GRAPPLING_HOOK },
@@ -3177,7 +3185,7 @@ struct obj *no_wish;
/* Alternate spellings (pick-ax, silver sabre, &c) */ /* Alternate spellings (pick-ax, silver sabre, &c) */
{ {
struct alt_spellings *as = spellings; const struct alt_spellings *as = spellings;
while (as->sp) { while (as->sp) {
if (fuzzymatch(bp, as->sp, " -", TRUE)) { if (fuzzymatch(bp, as->sp, " -", TRUE)) {