]> granicus.if.org Git - nethack/commitdiff
dungeon_overview adjustment
authornethack.allison <nethack.allison>
Wed, 21 Oct 2009 03:05:53 +0000 (03:05 +0000)
committernethack.allison <nethack.allison>
Wed, 21 Oct 2009 03:05:53 +0000 (03:05 +0000)
The dungeon_overview bits in the rm structure were being
clobbered by a run-length encoding save/restore because
they weren't taken into consideration.

This patch pulls that data out of the rm structure completely.

It also adjusts the run-length encoding checks to take the
candig bit into consideration and adds a comment to rm.h
reminding people to make run-length encoding adjustments
in save.c for any new bits that get added.

include/patchlevel.h
include/rm.h
src/bones.c
src/decl.c
src/display.c
src/dungeon.c
src/lock.c
src/read.c
src/restore.c
src/save.c

index 2f18517c92e78a256daf3d814caee85391f64cb1..b7f6452e08e360e51254ef9be0b9fd1a0efea403 100644 (file)
@@ -14,7 +14,7 @@
  * Incrementing EDITLEVEL can be used to force invalidation of old bones
  * and save files.
  */
-#define EDITLEVEL      43
+#define EDITLEVEL      44
 
 #define COPYRIGHT_BANNER_A \
 "NetHack, Copyright 1985-2009"
index 2b358cfb6431b23c4bc71710fb7af1a0afc84e80..4965f035ce7bfd19e45560d611ba6e22e3fcc739 100644 (file)
@@ -376,6 +376,9 @@ extern struct symsetentry symset[NUM_GRAPHICS];               /* from drawing.c */
  * The structure describing a coordinate position.
  * Before adding fields, remember that this will significantly affect
  * the size of temporary files and save files.
+ *
+ * Also remember that the run-length encoding for some ports in save.c
+ * must be updated to consider the field.
  */
 struct rm {
        int glyph;              /* what the hero thinks is there */
@@ -389,11 +392,6 @@ struct rm {
        Bitfield(roomno,6);     /* room # for special rooms */
        Bitfield(edge,1);       /* marks boundaries for special rooms*/
        Bitfield(candig,1);     /* Exception to Can_dig_down; was a trapdoor */
-
-#ifdef DUNGEON_OVERVIEW
-       Bitfield(styp, 6);      /* last seen/touched dungeon typ */
-       /* 2 free bits */
-#endif /* DUNGEON_OVERVIEW */
 };
 
 /*
@@ -541,6 +539,10 @@ typedef struct
 }
 dlevel_t;
 
+#ifdef DUNGEON_OVERVIEW
+extern schar lastseentyp[COLNO][ROWNO];        /* last seen/touched dungeon typ */
+#endif /* DUNGEON_OVERVIEW */
+
 extern dlevel_t level; /* structure describing the current level */
 
 /*
index fc426a328e957671f089ce89994e6846cc43f6ae..f17a5efb77c4b08ed295929d0e51fb6a7eea04b7 100644 (file)
@@ -402,7 +402,7 @@ struct obj *corpse;
            levl[x][y].waslit = 0;
            levl[x][y].glyph = cmap_to_glyph(S_stone);
 #ifdef DUNGEON_OVERVIEW
-           levl[x][y].styp = 0;
+           lastseentyp[x][y] = 0;
 #endif
        }
 
index 7edcabac8c6858bd15dc04f7dfbce2f090c8322f..0caf1aea1d766bab612657674063e73f6ac12593 100644 (file)
@@ -142,6 +142,11 @@ NEARDATA struct instance_flags iflags = DUMMY;
 NEARDATA struct you u = DUMMY;
 NEARDATA time_t ubirthday = DUMMY;
 
+
+#ifdef DUNGEON_OVERVIEW
+schar lastseentyp[COLNO][ROWNO] = {DUMMY}; /* last seen/touched dungeon typ */
+#endif /* DUNGEON_OVERVIEW */
+
 NEARDATA struct obj *invent = (struct obj *)0,
        *uwep = (struct obj *)0, *uarm = (struct obj *)0,
        *uswapwep = (struct obj *)0,
index ce9b80447c5f71ef11133d5a432a5ef0352a5e60..3c779e8f6ae51f23d9e6c68947407018ee27cf1a 100644 (file)
@@ -135,7 +135,7 @@ STATIC_DCL void FDECL(t_warn, (struct rm *));
 STATIC_DCL int FDECL(wall_angle, (struct rm *));
 
 #ifdef DUNGEON_OVERVIEW
-# define remember_topology(levp)       ((levp)->styp = (levp)->typ)
+# define remember_topology(x,y)                (lastseentyp[x][y] = levl[x][y].typ)
 #else
 # define remember_topology(levp)       /*empty*/
 #endif
@@ -193,7 +193,7 @@ magic_map_background(x, y, show)
        lev->glyph = glyph;
     if (show) show_glyph(x,y, glyph);
 
-    remember_topology(lev);    /* DUNGEON_OVERVIEW */
+    remember_topology(x,y);    /* DUNGEON_OVERVIEW */
 }
 
 /*
@@ -350,7 +350,7 @@ unmap_object(x, y)
     else                                                               \
        map_background(x,y,show);                                       \
                                                                        \
-    remember_topology(&levl[x][y]);    /* DUNGEON_OVERVIEW */          \
+    remember_topology(x,y);    /* DUNGEON_OVERVIEW */                  \
 }
 
 void
index 13bf91ffd48ff374f1a49c0d6736a797b31050cf..3f9919b3fbe3e26b7404cecfe551e08025cc2e5b 100644 (file)
@@ -2144,15 +2144,15 @@ recalc_mapseen()
         * (vision-related styp update done in loop below)
         */
        if (!Levitation)
-               levl[u.ux][u.uy].styp = levl[u.ux][u.uy].typ;
+               lastseentyp[u.ux][u.uy] = levl[u.ux][u.uy].typ;
 
        for (x = 0; x < COLNO; x++) {
                for (y = 0; y < ROWNO; y++) {
                        /* update styp from viz_array */
                        if (viz_array[y][x] & IN_SIGHT)
-                               levl[x][y].styp = levl[x][y].typ;
+                               lastseentyp[x][y] = levl[x][y].typ;
 
-                       switch (levl[x][y].styp) {
+                       switch (lastseentyp[x][y]) {
                        /*
                        case ICE:
                                mptr->feat.ice = 1;
index 569ace1a73f5114ef67b440a971d226afb797c08..e456cdf56fe3fcaf0cb35fd986e5214776707dd0 100644 (file)
@@ -567,13 +567,13 @@ doopen()          /* try to open a door */
        if (Blind) {
            int oldglyph = door->glyph;
 #ifdef DUNGEON_OVERVIEW
-           schar oldstyp = door->styp;
+           schar oldlastseentyp = lastseentyp[cc.x][cc.y];
 #endif
 
            feel_location(cc.x, cc.y);
            if (door->glyph != oldglyph
 #ifdef DUNGEON_OVERVIEW
-               || door->styp != oldstyp
+               || lastseentyp[cc.x][cc.y] != oldlastseentyp
 #endif
            ) res = 1;          /* learned something */
        }
@@ -695,13 +695,13 @@ doclose()         /* try to close a door */
        if (Blind) {
            int oldglyph = door->glyph;
 #ifdef DUNGEON_OVERVIEW
-           schar oldstyp = door->styp;
+           schar oldlastseentyp = lastseentyp[x][y];
 #endif
 
            feel_location(x, y);
            if (door->glyph != oldglyph
 #ifdef DUNGEON_OVERVIEW
-               || door->styp != oldstyp
+               || lastseentyp[x][y] != oldlastseentyp
 #endif
            ) res = 1;          /* learned something */
        }
index a730c95f88ae0cf4e0514a0551bfa377d32580fa..7f77042c8bb8fe0da7138bbeac7faaeb8b59a4a1 100644 (file)
@@ -573,7 +573,7 @@ forget_map(howmuch)
                levl[zx][zy].waslit = 0;
                levl[zx][zy].glyph = cmap_to_glyph(S_stone);
 #ifdef DUNGEON_OVERVIEW
-               levl[zx][zy].styp = STONE;
+               lastseentyp[zx][zy] = STONE;
 #endif
            }
 }
index e369eb6bd80f43f22da28285a73dac0a87bfbd90..197d293ff98a4d9d7ad52d4b08c45187addf7d51 100644 (file)
@@ -999,6 +999,9 @@ boolean ghostly;
            trickery(trickbuf);
        }
        rest_levl(fd, (boolean)((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
+#ifdef DUNGEON_OVERVIEW
+       mread(fd, (genericptr_t)lastseentyp, sizeof(lastseentyp));
+#endif
        mread(fd, (genericptr_t)&omoves, sizeof(omoves));
        elapsed = monstermoves - omoves;
        mread(fd, (genericptr_t)&upstair, sizeof(stairway));
index 3a1d32cc3b967b11b652441013ca65e845a8f959..d0c3dad536e9eefcf924516df762cd3688e7afeb 100644 (file)
@@ -514,7 +514,9 @@ int mode;
        bwrite(fd,(genericptr_t) &lev,sizeof(lev));
 #endif
        savelevl(fd, (boolean)((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
-
+#ifdef DUNGEON_OVERVIEW
+       bwrite(fd,(genericptr_t) lastseentyp,sizeof(lastseentyp));
+#endif
        bwrite(fd,(genericptr_t) &monstermoves,sizeof(monstermoves));
        bwrite(fd,(genericptr_t) &upstair,sizeof(stairway));
        bwrite(fd,(genericptr_t) &dnstair,sizeof(stairway));
@@ -579,7 +581,8 @@ boolean rlecomp;
                        && prm->lit == rgrm->lit
                        && prm->waslit == rgrm->waslit
                        && prm->roomno == rgrm->roomno
-                       && prm->edge == rgrm->edge) {
+                       && prm->edge == rgrm->edge
+                       && prm->candig == rgrm->candig) {
                        match++;
                        if (match > 254) {
                            match = 254;        /* undo this match */