current_fruit (trunk only)
I almost abandoned this when Michael beat me to it, but besides handling the fruit rename bug it also moves `current_fruit' into the context structure to eliminate separate save/restore for that.
This commit is contained in:
@@ -79,6 +79,7 @@ struct context_info {
|
||||
/* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
|
||||
/* 8: travel */
|
||||
unsigned startingpet_mid;
|
||||
int current_fruit; /* fruit->fid corresponding to pl_fruit[] */
|
||||
int warnlevel;
|
||||
int rndencode; /* randomized escape sequence introducer */
|
||||
long next_attrib_check; /* next attribute check */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)decl.h 3.5 2008/01/30 */
|
||||
/* SCCS Id: @(#)decl.h 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -131,7 +131,6 @@ E NEARDATA char pl_character[PL_CSIZ];
|
||||
E NEARDATA char pl_race; /* character's race */
|
||||
|
||||
E NEARDATA char pl_fruit[PL_FSIZ];
|
||||
E NEARDATA int current_fruit;
|
||||
E NEARDATA struct fruit *ffruit;
|
||||
|
||||
E NEARDATA char tune[6];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)patchlevel.h 3.5 2007/04/01 */
|
||||
/* SCCS Id: @(#)patchlevel.h 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
||||
* and save files.
|
||||
*/
|
||||
#define EDITLEVEL 40
|
||||
#define EDITLEVEL 41
|
||||
|
||||
#define COPYRIGHT_BANNER_A \
|
||||
"NetHack, Copyright 1985-2007"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)decl.c 3.5 2008/01/30 */
|
||||
/* SCCS Id: @(#)decl.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -55,7 +55,6 @@ NEARDATA char pl_character[PL_CSIZ] = DUMMY;
|
||||
NEARDATA char pl_race = '\0';
|
||||
|
||||
NEARDATA char pl_fruit[PL_FSIZ] = DUMMY;
|
||||
NEARDATA int current_fruit = 0;
|
||||
NEARDATA struct fruit *ffruit = (struct fruit *)0;
|
||||
|
||||
NEARDATA char tune[6] = DUMMY;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)eat.c 3.5 2008/05/26 */
|
||||
/* SCCS Id: @(#)eat.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1747,8 +1747,8 @@ struct obj *otmp;
|
||||
}
|
||||
/* Fall through otherwise */
|
||||
default:
|
||||
if (otmp->otyp==SLIME_MOLD && !otmp->cursed
|
||||
&& otmp->spe == current_fruit)
|
||||
if (otmp->otyp == SLIME_MOLD && !otmp->cursed &&
|
||||
otmp->spe == context.current_fruit)
|
||||
pline("My, that was a %s %s!",
|
||||
Hallucination ? "primo" : "yummy",
|
||||
singular(otmp, xname));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)mkobj.c 3.5 2007/11/10 */
|
||||
/* SCCS Id: @(#)mkobj.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -675,7 +675,7 @@ boolean artif;
|
||||
blessorcurse(otmp, 10);
|
||||
break;
|
||||
case SLIME_MOLD:
|
||||
otmp->spe = current_fruit;
|
||||
otmp->spe = context.current_fruit;
|
||||
break;
|
||||
case KELP_FROND:
|
||||
otmp->quan = (long) rnd(2);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)objnam.c 3.5 2008/01/23 */
|
||||
/* SCCS Id: @(#)objnam.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2184,7 +2184,7 @@ struct obj *no_wish;
|
||||
int islit, unlabeled, ishistoric, isdiluted, trapped;
|
||||
int tmp, tinv, tvariety;
|
||||
struct fruit *f;
|
||||
int ftype = current_fruit;
|
||||
int ftype = context.current_fruit;
|
||||
char fruitbuf[BUFSZ];
|
||||
/* Fruits may not mess up the ability to wish for real objects (since
|
||||
* you can leave a fruit in a bones file and it will be added to
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)options.c 3.5 2008/02/19 */
|
||||
/* SCCS Id: @(#)options.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -4106,13 +4106,12 @@ 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))) {
|
||||
highest_fruit_id = f->fid;
|
||||
(*altname && !strcmp(altname, f->fname)))
|
||||
goto nonew;
|
||||
}
|
||||
}
|
||||
/* if adding another fruit would overflow spe, use a random
|
||||
fruit instead... we've got a lot to choose from. */
|
||||
fruit instead... we've got a lot to choose from.
|
||||
current_fruit remains as is. */
|
||||
if (highest_fruit_id >= 127) return rnd(127);
|
||||
highest_fruit_id++;
|
||||
f = newfruit();
|
||||
@@ -4121,8 +4120,8 @@ char *str;
|
||||
copynchars(f->fname, *altname ? altname : str, PL_FSIZ-1);
|
||||
f->fid = highest_fruit_id;
|
||||
f->nextf = 0;
|
||||
nonew:
|
||||
if (user_specified) current_fruit = highest_fruit_id;
|
||||
nonew:
|
||||
if (user_specified) context.current_fruit = f->fid;
|
||||
return f->fid;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)pager.c 3.5 2008/03/19 */
|
||||
/* SCCS Id: @(#)pager.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -221,7 +221,7 @@ lookat(x, y, buf, monbuf)
|
||||
if (otmp->oclass == COIN_CLASS)
|
||||
otmp->quan = 2L; /* to force pluralization */
|
||||
else if (otmp->otyp == SLIME_MOLD)
|
||||
otmp->spe = current_fruit; /* give the fruit a type */
|
||||
otmp->spe = context.current_fruit; /* give it a type */
|
||||
Strcpy(buf, distant_name(otmp, xname));
|
||||
dealloc_obj(otmp);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)restore.c 3.5 2007/04/21 */
|
||||
/* SCCS Id: @(#)restore.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -658,7 +658,6 @@ unsigned int *stuckid, *steedid; /* STEED */
|
||||
mread(fd, (genericptr_t) pl_character, sizeof pl_character);
|
||||
|
||||
mread(fd, (genericptr_t) pl_fruit, sizeof pl_fruit);
|
||||
mread(fd, (genericptr_t) ¤t_fruit, sizeof current_fruit);
|
||||
freefruitchn(ffruit); /* clean up fruit(s) made by initoptions() */
|
||||
ffruit = loadfruitchn(fd);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)save.c 3.5 2007/01/08 */
|
||||
/* SCCS Id: @(#)save.c 3.5 2008/07/20 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -357,7 +357,6 @@ register int fd, mode;
|
||||
#endif
|
||||
bwrite(fd, (genericptr_t) pl_character, sizeof pl_character);
|
||||
bwrite(fd, (genericptr_t) pl_fruit, sizeof pl_fruit);
|
||||
bwrite(fd, (genericptr_t) ¤t_fruit, sizeof current_fruit);
|
||||
savefruitchn(fd, mode);
|
||||
savenames(fd, mode);
|
||||
save_waterlevel(fd, mode);
|
||||
|
||||
Reference in New Issue
Block a user