]> granicus.if.org Git - nethack/commitdiff
Several things that break savefile compatibility
authornethack.allison <nethack.allison>
Wed, 5 Mar 2003 04:39:47 +0000 (04:39 +0000)
committernethack.allison <nethack.allison>
Wed, 5 Mar 2003 04:39:47 +0000 (04:39 +0000)
- 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

13 files changed:
include/display.h
include/flag.h
include/patchlevel.h
src/allmain.c
src/cmd.c
src/hack.c
src/mapglyph.c
src/options.c
src/pager.c
src/pickup.c
src/restore.c
src/save.c
util/makedefs.c

index b94d308bf9864ccbafb0222a74d3f3739c771768..67f86279ea5b1cd67ab7caee0a75ae54293eb79b 100644 (file)
 /* 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)
 
index badbd7df2ada2ce1ffddb01dd78de45550c147c5..3c78743c8dc251791a75d2b50892441a608c350b 100644 (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 */
 };
 
 /*
index f4f5818895bf1890ef1d90d97e522aef0b454afb..ecab033d4078f1bbd03913440a078a5f0576483e 100644 (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
  * 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
index 81350f448f0af63317986bf29f12302278a14e16..6e3070414e63d286c3cd9301753a61289684d3d1 100644 (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);
index e778cf982aecc9c2ec6d8a349de05c49855495af..f04d5a8bb959a89aa73aadc6f8e000bd3844b0ae 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -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;
index cc7c8ef384365f0e7b1a1113bc2945a9ca9c9c1a..594c523fa134ace67e029080387383f06a34f6dd 100644 (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();
index e22af26e26782ba2b515e398febc2df15bc2d13f..718dc766001d95242411a85a407dbf5dcc3cfe52 100644 (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
        }
index 4f5fb28f2f0f19aab6ad8eaf7cbe463b01220314..8df297995af1e02442a2bcf01d2c95b37d1aa0e6 100644 (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" : "");
index b955468266164eae2611bc58aa7cb30163fe1e48..58d5f0a05d839f8ee51cbb18b325c9978c4f0ce7 100644 (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" */
 
index b90a4853d721eca5b071e32b9d144d21912e0e83..ae11c47af3adbd7dbc452f6bd7f5b7af12a51ff9 100644 (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);
index ea709661264abb048af9146ffa0d1003f4ea6e21..a9391fda5d26b1da404e6fb6c7ee37038cbc22af 100644 (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);
index 8fb4a55a1dc181a100e4f1158265b0f342b2afb1..ea53b22bd701aeceab27cc846f4e02202b42eb0b 100644 (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));
index 79cad1637b148c47bbcb3b02db567bd0709993b2..af6fe1669a853bebb8d195c9217392197bc2aed0 100644 (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()