flag changes

Several flags added since 3.4.0 were destined for flags
(to be saved with the game) but were placed in iflags for
savefile compatibility.  These include:
 boolean  lootabc;	/* use "a/b/c" rather than "o/i/b" when looting */
 boolean  showrace;	/* show hero glyph by race rather than by role */
 boolean  travelcmd;	/* allow travel command */
 int	 runmode;	/* update screen display during run moves */

This patch has no effect unless you define this in your port's
XXconf.h file.
#define SAVEFILE_340_CONVERT	/* allow moving of some iflags fields to flags
					without destroying savefile compatibility */
Without it, the new flags remain in "iflags."  With it, the flags are moved to
"flags" and the structures are converted when the save file is read. There
is no reverse compatibility.  If you save the game after conversion, you
can't load the savefile on 3.4.0, only 3.4.1.
This commit is contained in:
nethack.allison
2002-07-28 16:03:00 +00:00
parent aedd6947d4
commit 46721b5a91
12 changed files with 360 additions and 23 deletions

View File

@@ -106,7 +106,7 @@ static struct Bool_Opt
{"large_font", &iflags.wc_large_font, FALSE, SET_IN_FILE}, /*WC*/
{"legacy", &flags.legacy, TRUE, DISP_IN_GAME},
{"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME},
{"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME},
{"lootabc", &Xflags.lootabc, FALSE, SET_IN_GAME},
#ifdef MAC_GRAPHICS_ENV
{"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_GAME},
#else
@@ -158,7 +158,7 @@ static struct Bool_Opt
#else
{"showexp", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"showrace", &iflags.showrace, FALSE, SET_IN_GAME},
{"showrace", &Xflags.showrace, FALSE, SET_IN_GAME},
#ifdef SCORE_ON_BOTL
{"showscore", &flags.showscore, FALSE, SET_IN_GAME},
#else
@@ -179,7 +179,7 @@ static struct Bool_Opt
#endif
{"tombstone",&flags.tombstone, TRUE, SET_IN_GAME},
{"toptenwin",&flags.toptenwin, FALSE, SET_IN_GAME},
{"travel", &iflags.travelcmd, TRUE, SET_IN_GAME},
{"travel", &Xflags.travelcmd, TRUE, SET_IN_GAME},
{"use_inverse", &iflags.wc_inverse, FALSE, SET_IN_GAME}, /*WC*/
{"verbose", &flags.verbose, TRUE, SET_IN_GAME},
{(char *)0, (boolean *)0, FALSE, 0}
@@ -474,10 +474,13 @@ initoptions()
if (boolopt[i].addr)
*(boolopt[i].addr) = boolopt[i].initvalue;
}
#ifdef SAVEFILE_340_CONVERT
flags.version = 341;
#endif
flags.end_own = FALSE;
flags.end_top = 3;
flags.end_around = 2;
iflags.runmode = RUN_LEAP;
Xflags.runmode = RUN_LEAP;
iflags.msg_history = 20;
#ifdef TTY_GRAPHICS
iflags.prevmsg_window = 's';
@@ -1056,16 +1059,16 @@ boolean tinitial, tfrom_file;
fullname = "runmode";
if (match_optname(opts, fullname, 4, TRUE)) {
if (negated) {
iflags.runmode = RUN_TPORT;
Xflags.runmode = RUN_TPORT;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
if (!strncmpi(op, "teleport", strlen(op)))
iflags.runmode = RUN_TPORT;
Xflags.runmode = RUN_TPORT;
else if (!strncmpi(op, "run", strlen(op)))
iflags.runmode = RUN_LEAP;
Xflags.runmode = RUN_LEAP;
else if (!strncmpi(op, "walk", strlen(op)))
iflags.runmode = RUN_STEP;
Xflags.runmode = RUN_STEP;
else if (!strncmpi(op, "crawl", strlen(op)))
iflags.runmode = RUN_CRAWL;
Xflags.runmode = RUN_CRAWL;
else
badoption(opts);
}
@@ -2099,7 +2102,7 @@ goodfruit:
vision_full_recalc = 1; /* delayed recalc */
}
else if ((boolopt[i].addr) == &iflags.use_inverse ||
(boolopt[i].addr) == &iflags.showrace ||
(boolopt[i].addr) == &Xflags.showrace ||
(boolopt[i].addr) == &iflags.hilite_pet) {
need_redraw = TRUE;
}
@@ -2514,7 +2517,7 @@ boolean setinitial,setfromfile;
}
end_menu(tmpwin, "Select run/travel display mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
iflags.runmode = mode_pick->item.a_int - 1;
Xflags.runmode = mode_pick->item.a_int - 1;
free((genericptr_t)mode_pick);
}
destroy_nhwindow(tmpwin);
@@ -2716,7 +2719,7 @@ char *buf;
else if (!strcmp(optname, "role"))
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
else if (!strcmp(optname, "runmode"))
Sprintf(buf, "%s", runmodes[iflags.runmode]);
Sprintf(buf, "%s", runmodes[Xflags.runmode]);
else if (!strcmp(optname, "scores")) {
Sprintf(buf, "%d top/%d around%s", flags.end_top,
flags.end_around, flags.end_own ? "/own" : "");