change of fruit name

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.
This commit is contained in:
nethack.allison
2008-07-19 22:56:37 +00:00
parent 998c399543
commit 60b7b2c0f0
2 changed files with 5 additions and 1 deletions

View 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

View 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. */