]> granicus.if.org Git - nethack/commitdiff
named fruit vs glob bit
authorPatR <rankin@nethack.org>
Mon, 23 May 2022 18:31:48 +0000 (11:31 -0700)
committerPatR <rankin@nethack.org>
Mon, 23 May 2022 18:31:48 +0000 (11:31 -0700)
3.7 has a new size prefix for globs that 3.6 didn't.  The code that
decides whether player is naming slime molds after an actual object
needs to know about it.

src/options.c

index 04bb64b0e12f304e49c678290a4a49887f12732a..900dcfb19c518f70c4b940f6918aff5b1d26639b 100644 (file)
@@ -7230,8 +7230,6 @@ fruitadd(char *str, struct fruit *replace_fruit)
            str==pl_fruit but makesingular() creates a copy
            so we need to copy that back into pl_fruit */
         nmcpy(g.pl_fruit, makesingular(str), PL_FSIZ);
-        /* (assertion doesn't matter; we use 'g.pl_fruit' from here on out) */
-        /* assert( str == g.pl_fruit ); */
 
         /* disallow naming after other foods (since it'd be impossible
          * to tell the difference); globs might have a size prefix which
@@ -7239,8 +7237,9 @@ fruitadd(char *str, struct fruit *replace_fruit)
          */
         globpfx = (!strncmp(g.pl_fruit, "small ", 6)
                    || !strncmp(g.pl_fruit, "large ", 6)) ? 6
-                  : (!strncmp(g.pl_fruit, "very large ", 11)) ? 11
-                    : 0;
+                  : (!strncmp(g.pl_fruit, "medium ", 7)) ? 7
+                    : (!strncmp(g.pl_fruit, "very large ", 11)) ? 11
+                      : 0;
         for (i = g.bases[FOOD_CLASS]; objects[i].oc_class == FOOD_CLASS; i++) {
             if (!strcmp(OBJ_NAME(objects[i]), g.pl_fruit)
                 || (globpfx > 0