]> granicus.if.org Git - nethack/commitdiff
change of fruit name
authornethack.allison <nethack.allison>
Sat, 19 Jul 2008 22:56:37 +0000 (22:56 +0000)
committernethack.allison <nethack.allison>
Sat, 19 Jul 2008 22:56:37 +0000 (22:56 +0000)
From a bug report:
The following steps do not yield the expected fruit:
  1) start nethack in explore mode (with a wand of wishing)
  2) change fruit name to "tomato"
  3) save/restore
  4) change fruit name back to "slime mold"
  5) save/restore
  6) wish for a fruit; you get a tomato
  7) check options; fruit name is set to "slime mold"

If you specified a fruit name that already existed in the list,
fruitadd() always set current_fruit to the fruit with
the highest fid encountered in the list to that point, instead
of the fid of the matching entry.

doc/fixes34.4
src/options.c

index 9cbf2da9d26289044ba668dacaf91b608a8cd69c..492c4b37a52b1afe55f01eabbffd3560d3fbdfbb 100644 (file)
@@ -371,6 +371,8 @@ jellyfish do not technically have a head
 potion explosion during failed alchemy should awaken nearby monsters
 lit south wall of C quest leader's room contained dark gap at secret door spot
 archeologist shouldn't start with sling skill by carrying slingable touchstone
+ensure current_fruit gets set to the correct index when setting fruit
+       option to existing entry whose fid is not the highest
 
 
 Platform- and/or Interface-Specific Fixes
index b6d61a826502c5b29df573908f865b204d89d834..d9ae04f3a202e2cf2e18f7d6984822bacc994b38 100644 (file)
@@ -4106,8 +4106,10 @@ char *str;
                lastf = f;
                if(f->fid > highest_fruit_id) highest_fruit_id = f->fid;
                if (!strncmp(str, f->fname, PL_FSIZ-1) ||
-                           (*altname && !strcmp(altname, f->fname)))
+                           (*altname && !strcmp(altname, f->fname))) {
+                       highest_fruit_id = f->fid;
                        goto nonew;
+               }
        }
        /* if adding another fruit would overflow spe, use a random
           fruit instead... we've got a lot to choose from. */