dungeon_overview adjustment

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.
This commit is contained in:
nethack.allison
2009-10-21 03:05:53 +00:00
parent e8ca39ff07
commit 7c05c92eed
10 changed files with 33 additions and 20 deletions

View 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
}

View 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,

View 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

View 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;

View 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 */
}

View 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
}
}

View 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));

View 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 */