From 60b7b2c0f0b60d439bc1e64839665cddb6984aca Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sat, 19 Jul 2008 22:56:37 +0000 Subject: [PATCH] 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. --- doc/fixes34.4 | 2 ++ src/options.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 9cbf2da9d..492c4b37a 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/options.c b/src/options.c index b6d61a826..d9ae04f3a 100644 --- a/src/options.c +++ b/src/options.c @@ -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. */