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:
@@ -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"
|
||||
|
||||
12
include/rm.h
12
include/rm.h
@@ -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 */
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user