]> granicus.if.org Git - nethack/commitdiff
hobbit tidbit (trunk only)
authornethack.rankin <nethack.rankin>
Sun, 2 Oct 2011 02:18:54 +0000 (02:18 +0000)
committernethack.rankin <nethack.rankin>
Sun, 2 Oct 2011 02:18:54 +0000 (02:18 +0000)
     While testing the need-hands-to-open-tins patch, I tried to polyself
into a halfling and failed.  Add it to the monster name lookup routine as
a variant spelling for hobbit.

src/mondata.c

index e4203297ca3411d2f7bca5c02d4596f5b3c6c75f..029c00d9cdfa595179c9b8e36d40a91f3614a42d 100644 (file)
@@ -621,6 +621,8 @@ const char *in_str;
                { "master of assassin", PM_MASTER_ASSASSIN },
            /* Outdated names */
                { "invisible stalker",  PM_STALKER },
+               { "high-elf",           PM_ELVENKING }, /* PM_HIGH_ELF is obsolete */
+               { "halfling",           PM_HOBBIT }, /* potential guess for polyself */
            /* Hyphenated names */
                { "ki rin",             PM_KI_RIN },
                { "uruk hai",           PM_URUK_HAI },
@@ -630,9 +632,6 @@ const char *in_str;
                { "grey elf",           PM_GREY_ELF },
                { "gray elf",           PM_GREY_ELF },
                { "elf lord",           PM_ELF_LORD },
-#if 0  /* OBSOLETE */
-               { "high elf",           PM_HIGH_ELF },
-#endif
                { "olog hai",           PM_OLOG_HAI },
                { "arch lich",          PM_ARCH_LICH },
            /* Some irregular plurals */
@@ -660,8 +659,9 @@ const char *in_str;
        for (len = 0, i = LOW_PM; i < NUMMONS; i++) {
            register int m_i_len = strlen(mons[i].mname);
            if (m_i_len > len && !strncmpi(mons[i].mname, str, m_i_len)) {
-               if (m_i_len == slen) return i;  /* exact match */
-               else if (slen > m_i_len &&
+               if (m_i_len == slen) {
+                  return i;    /* exact match */
+               } else if (slen > m_i_len &&
                        (str[m_i_len] == ' ' ||
                         !strcmpi(&str[m_i_len], "s") ||
                         !strncmpi(&str[m_i_len], "s ", 2) ||