From f25f92c27130fd272c48502cb14a8ef4dd1996a4 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 19 Oct 2018 01:47:29 -0700 Subject: [PATCH] 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. --- src/mondata.c | 6 ++++-- src/objnam.c | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/mondata.c b/src/mondata.c index ffffb9e85..312448466 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -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) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -740,7 +740,9 @@ const char *in_str; { "invisible stalker", PM_STALKER }, { "high-elf", PM_ELVENKING }, /* PM_HIGH_ELF is obsolete */ { "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 }, { "uruk hai", PM_URUK_HAI }, { "orc captain", PM_ORC_CAPTAIN }, diff --git a/src/objnam.c b/src/objnam.c index ce952c36f..c9d00f6ab 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -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) Robert Patrick Rankin, 2011. */ /* 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 + 3 && lowc(p[-3]) == 'i') { /* "ies" */ 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, "yries")) /* valkyrie */ 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" vs "pick-axe") then there is no need for inclusion in this list; likewise for ``"of" inversions'' ("boots of speed" vs "speed boots") */ -struct alt_spellings { +static const struct alt_spellings { const char *sp; int ob; } spellings[] = { @@ -2673,6 +2679,8 @@ struct alt_spellings { { "eucalyptus", EUCALYPTUS_LEAF }, { "royal jelly", LUMP_OF_ROYAL_JELLY }, { "lembas", LEMBAS_WAFER }, + { "cookie", FORTUNE_COOKIE }, + { "pie", CREAM_PIE }, { "marker", MAGIC_MARKER }, { "hook", GRAPPLING_HOOK }, { "grappling iron", GRAPPLING_HOOK }, @@ -3177,7 +3185,7 @@ struct obj *no_wish; /* Alternate spellings (pick-ax, silver sabre, &c) */ { - struct alt_spellings *as = spellings; + const struct alt_spellings *as = spellings; while (as->sp) { if (fuzzymatch(bp, as->sp, " -", TRUE)) { -- 2.40.0