Several things that break savefile compatibility

- Version change from 3.4.x
- timed_delay feature ignore in makedefs
- several flags from iflags to flags
- use offsets from mons array entries in save file rather than storing
  the ptr and calculating the distance from beginning of array
This commit is contained in:
nethack.allison
2003-03-05 04:39:47 +00:00
parent 14c53eb840
commit 5122409416
13 changed files with 54 additions and 59 deletions

View File

@@ -313,7 +313,7 @@
/* The hero's glyph when seen as a monster.
*/
#define hero_glyph \
monnum_to_glyph((Upolyd || !iflags.showrace) ? u.umonnum : \
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : \
(flags.female && urace.femalenum != NON_PM) ? urace.femalenum : \
urace.malenum)

View File

@@ -146,6 +146,11 @@ struct flag {
int initalign; /* starting alignment (index into aligns[]) */
int randomall; /* randomly assign everything not specified */
int pantheon; /* deity selection for priest character */
/* Items which were in iflags in 3.4.x to preserve savefile compatibility */
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 */
};
/*
@@ -257,11 +262,6 @@ struct instance_flags {
boolean cmdassist; /* provide detailed assistance for some commands */
boolean obsolete; /* obsolete options can point at this, it isn't used */
/* Items which belong in flags, but are here to allow save compatibility */
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 */
};
/*

View File

@@ -1,14 +1,14 @@
/* SCCS Id: @(#)patchlevel.h 3.4 2003/02/19 */
/* SCCS Id: @(#)patchlevel.h 3.4 2003/03/04 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* NetHack 3.4.1 */
/* NetHack 3.5.0 */
#define VERSION_MAJOR 3
#define VERSION_MINOR 4
#define VERSION_MINOR 5
/*
* PATCHLEVEL is updated for each release.
*/
#define PATCHLEVEL 1
#define PATCHLEVEL 0
/*
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
@@ -24,7 +24,7 @@
#define COPYRIGHT_BANNER_C \
" See license for details."
#if 1
#if 0
/*
* If two successive patchlevels have compatible data files (fat chance),
* defining this with the value of the older one will allow its bones and
@@ -34,12 +34,26 @@
* PP = patch level, ee = edit level, L = literal suffix "L",
* with all four numbers specified as two hexadecimal digits.
*/
#define VERSION_COMPATIBILITY 0x03040000L
#define VERSION_COMPATIBILITY 0x03040100L
#endif
/*****************************************************************************/
/* Version 3.5.x */
/*
* NetHack 3.5.0, March NN, NNNN
*
*/
/* Version 3.5 */
/*****************************************************************************/
/* Version 3.4.x */
/* Patch 2, March 17, 2003
* Fix a few fatal errors
*/
/* Patch 1, February 22, 2003
* Fix a few fatal errors including one for reentering shops, one
* involving land mines and boulders/statues, one for delayed

View File

@@ -413,7 +413,7 @@ moveloop()
if (vision_full_recalc) vision_recalc(0); /* vision! */
/* when running in non-tport mode, this gets done through domove() */
if ((!flags.run || iflags.runmode == RUN_TPORT) &&
if ((!flags.run || flags.runmode == RUN_TPORT) &&
(multi && (!flags.travel ? !(multi % 7) : !(moves % 7L)))) {
if (flags.time && flags.run) flags.botl = 1;
display_nhwindow(WIN_MAP, FALSE);

View File

@@ -1840,7 +1840,7 @@ register char *cmd;
multi = 0;
return;
case CMD_TRAVEL:
if (iflags.travelcmd) {
if (flags.travelcmd) {
flags.travel = 1;
flags.run = 8;
flags.nopick = 1;
@@ -2156,7 +2156,7 @@ click_to_cmd(x, y, mod)
x -= u.ux;
y -= u.uy;
if (iflags.travelcmd) {
if (flags.travelcmd) {
if (abs(x) <= 1 && abs(y) <= 1 ) {
x = sgn(x), y = sgn(y);
} else {
@@ -2382,7 +2382,7 @@ dotravel()
static char cmd[2];
coord cc;
if (!iflags.travelcmd) return 0;
if (!flags.travelcmd) return 0;
cmd[1]=0;
cc.x = u.ux;
cc.y = u.uy;

View File

@@ -1377,13 +1377,13 @@ domove()
nomovemsg = "";
}
if (flags.run && iflags.runmode != RUN_TPORT) {
if (flags.run && flags.runmode != RUN_TPORT) {
/* display every step or every 7th step depending upon mode */
if (iflags.runmode != RUN_LEAP || !(moves % 7L)) {
if (flags.runmode != RUN_LEAP || !(moves % 7L)) {
if (flags.time) flags.botl = 1;
curs_on_u();
delay_output();
if (iflags.runmode == RUN_CRAWL) {
if (flags.runmode == RUN_CRAWL) {
delay_output();
delay_output();
delay_output();

View File

@@ -202,7 +202,7 @@ unsigned *ospecial;
/* special case the hero for `showrace' option */
#ifdef TEXTCOLOR
if (iflags.use_color && x == u.ux && y == u.uy &&
iflags.showrace && !Upolyd)
flags.showrace && !Upolyd)
color = HI_DOMESTIC;
#endif
}

View File

@@ -113,7 +113,7 @@ static struct Bool_Opt
{"large_font", &iflags.obsolete, FALSE, SET_IN_FILE}, /* OBSOLETE */
{"legacy", &flags.legacy, TRUE, DISP_IN_GAME},
{"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME},
{"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME},
{"lootabc", &flags.lootabc, FALSE, SET_IN_GAME},
#ifdef MAC_GRAPHICS_ENV
{"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_GAME},
#else
@@ -165,7 +165,7 @@ static struct Bool_Opt
#else
{"showexp", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"showrace", &iflags.showrace, FALSE, SET_IN_GAME},
{"showrace", &flags.showrace, FALSE, SET_IN_GAME},
#ifdef SCORE_ON_BOTL
{"showscore", &flags.showscore, FALSE, SET_IN_GAME},
#else
@@ -186,7 +186,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", &flags.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}
@@ -489,7 +489,7 @@ initoptions()
flags.end_own = FALSE;
flags.end_top = 3;
flags.end_around = 2;
iflags.runmode = RUN_LEAP;
flags.runmode = RUN_LEAP;
iflags.msg_history = 20;
#ifdef TTY_GRAPHICS
iflags.prevmsg_window = 's';
@@ -1069,16 +1069,16 @@ boolean tinitial, tfrom_file;
fullname = "runmode";
if (match_optname(opts, fullname, 4, TRUE)) {
if (negated) {
iflags.runmode = RUN_TPORT;
flags.runmode = RUN_TPORT;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
if (!strncmpi(op, "teleport", strlen(op)))
iflags.runmode = RUN_TPORT;
flags.runmode = RUN_TPORT;
else if (!strncmpi(op, "run", strlen(op)))
iflags.runmode = RUN_LEAP;
flags.runmode = RUN_LEAP;
else if (!strncmpi(op, "walk", strlen(op)))
iflags.runmode = RUN_STEP;
flags.runmode = RUN_STEP;
else if (!strncmpi(op, "crawl", strlen(op)))
iflags.runmode = RUN_CRAWL;
flags.runmode = RUN_CRAWL;
else
badoption(opts);
}
@@ -2133,7 +2133,7 @@ goodfruit:
vision_full_recalc = 1; /* delayed recalc */
}
else if ((boolopt[i].addr) == &iflags.use_inverse ||
(boolopt[i].addr) == &iflags.showrace ||
(boolopt[i].addr) == &flags.showrace ||
(boolopt[i].addr) == &iflags.hilite_pet) {
need_redraw = TRUE;
}
@@ -2550,7 +2550,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;
flags.runmode = mode_pick->item.a_int - 1;
free((genericptr_t)mode_pick);
}
destroy_nhwindow(tmpwin);
@@ -2783,7 +2783,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[flags.runmode]);
else if (!strcmp(optname, "scores")) {
Sprintf(buf, "%d top/%d around%s", flags.end_top,
flags.end_around, flags.end_own ? "/own" : "");

View File

@@ -577,7 +577,7 @@ do_look(quick)
symbol; firstmatch is assumed to already be set for '@' */
if ((from_screen ?
(sym == monsyms[S_HUMAN] && cc.x == u.ux && cc.y == u.uy) :
(sym == def_monsyms[S_HUMAN] && !iflags.showrace)) &&
(sym == def_monsyms[S_HUMAN] && !flags.showrace)) &&
!(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd)
found += append_str(out_str, "you"); /* tack on "or you" */

View File

@@ -2259,7 +2259,7 @@ boolean outokay, inokay;
menu_item *pick_list;
char buf[BUFSZ];
int n;
const char *menuselector = iflags.lootabc ? "abc" : "oib";
const char *menuselector = flags.lootabc ? "abc" : "oib";
any.a_void = 0;
win = create_nhwindow(NHW_MENU);

View File

@@ -251,13 +251,7 @@ boolean ghostly;
{
register struct monst *mtmp, *mtmp2 = 0;
register struct monst *first = (struct monst *)0;
int xl;
struct permonst *monbegin;
boolean moved;
/* get the original base address */
mread(fd, (genericptr_t)&monbegin, sizeof(monbegin));
moved = (monbegin != mons);
int xl, offset;
while(1) {
mread(fd, (genericptr_t) &xl, sizeof(xl));
@@ -271,10 +265,8 @@ boolean ghostly;
add_id_mapping(mtmp->m_id, nid);
mtmp->m_id = nid;
}
if (moved && mtmp->data) {
int offset = mtmp->data - monbegin; /*(ptrdiff_t)*/
mtmp->data = mons + offset; /* new permonst location */
}
offset = mtmp->mnum;
mtmp->data = &mons[offset];
if(mtmp->minvent) {
struct obj *obj;
mtmp->minvent = restobjchn(fd, ghostly, FALSE);

View File

@@ -274,7 +274,6 @@ savegamestate(fd, mode)
register int fd, mode;
{
int uid;
#ifdef MFLOPPY
count_only = (mode & COUNT_SAVE);
#endif
@@ -875,14 +874,11 @@ register struct monst *mtmp;
register struct monst *mtmp2;
unsigned int xl;
int minusone = -1;
struct permonst *monbegin = &mons[0];
if (perform_bwrite(mode))
bwrite(fd, (genericptr_t) &monbegin, sizeof(monbegin));
while (mtmp) {
mtmp2 = mtmp->nmon;
if (perform_bwrite(mode)) {
mtmp->mnum = monsndx(mtmp->data);
xl = mtmp->mxlth + mtmp->mnamelth;
bwrite(fd, (genericptr_t) &xl, sizeof(int));
bwrite(fd, (genericptr_t) mtmp, xl + sizeof(struct monst));

View File

@@ -407,16 +407,9 @@ do_rumors()
}
/*
* 3.4.1: way back in 3.2.1 `flags.nap' became unconditional but
* TIMED_DELAY was erroneously left in VERSION_FEATURES and has
* been there up through 3.4.0. Simply removing it now would
* break save file compatibility with 3.4.0 files, so we will
* explicitly mask it out during version checks.
* This should go away in the next version update.
* Use this to explicitly mask out features during version checks.
*/
#define IGNORED_FEATURES ( 0L \
| (1L << 23) /* TIMED_DELAY */ \
)
#define IGNORED_FEATURES ( 0L )
static void
make_version()