fix github issue #606 - shop wall repair

triggering an impossible warning about "wall_angle: unknown" due
to the known conflict between door state and wall info which both
overlay the flags field for map locations.

Reported and diagnosed by vultur-cadens:  if a shop's wall was dug
open, followed by use of locking magic to plug the gap with a door,
and then unlocking that door, the D_CLOSED door flag was left as
invalid wall_info when shop damage was repaired.  Map re-display
complained.  Leaving the door locked or opening it after unlocking
did not result in any complaint because the values for those door
states do not conflict with wall angle values.

The problem was reproducible and is now fixed by adding an extra
field to the shop damage structure.  A similar change has been
made to the vault guard's 'fake corridor' structure but I have no
test case for that so don't know whether it makes any difference.
At least it doesn't seem to have broken anything.

Existing save and bones files are invalidated by the fixes.

Fixes #606
This commit is contained in:
PatR
2021-10-15 15:43:23 -07:00
parent 53bb04d9ad
commit d9bbad8e6e
7 changed files with 107 additions and 46 deletions

View File

@@ -69,7 +69,9 @@
#define GD_DESTROYGOLD 0x02
struct fakecorridor {
xchar fx, fy, ftyp;
xchar fx, fy;
schar ftyp; /* from struct rm's typ */
uchar flags; /* also from struct rm; an unsigned 5-bit field there */
};
struct egd {

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 42
#define EDITLEVEL 43
/*
* Development status possibilities.

View File

@@ -114,20 +114,27 @@ enum levl_typ_types {
* a secret door is revealed, the door gets set to D_CLOSED iff
* it isn't set to D_LOCKED (see cvt_sdoor_to_door() in detect.c).
*
* D_TRAPPED conflicts with W_NONDIGGABLE but the latter is not
* expected to be used on door locations.
* D_LOCKED conflicts with W_NONDIGGABLE but the latter is not
* expected to be used on door locations. D_TRAPPED conflicts
* with W_NONPASSWALL but secret doors aren't trapped.
* D_SECRET would not fit within struct rm's 5-bit 'flags' field.
*/
/*
* The 5 possible states of doors.
* For historical reasons they are numbered as mask bits rather than 0..4.
* The trapped flag is OR'd onto the state and only valid if that state
* is closed or locked.
* The no-door state allows egress when moving diagonally, others do not.
*/
#define D_NODOOR 0
#define D_BROKEN 1
#define D_ISOPEN 2
#define D_CLOSED 4
#define D_LOCKED 8
#define D_TRAPPED 16
#define D_SECRET 32 /* only used by sp_lev.c, NOT in rm-struct */
#define D_NODOOR 0x00
#define D_BROKEN 0x01
#define D_ISOPEN 0x02
#define D_CLOSED 0x04
#define D_LOCKED 0x08
#define D_TRAPPED 0x10
#define D_SECRET 0x20 /* only used by sp_lev.c, NOT in rm-struct */
/*
* Thrones should only be looted once.
@@ -213,7 +220,7 @@ enum levl_typ_types {
*/
struct rm {
int glyph; /* what the hero thinks is there */
schar typ; /* what is really there */
schar typ; /* what is really there [why is this signed?] */
uchar seenv; /* seen vector */
Bitfield(flags, 5); /* extra information for typ */
Bitfield(horizontal, 1); /* wall/door/etc is horiz. (more typ info) */
@@ -322,7 +329,8 @@ struct damage {
struct damage *next;
long when, cost;
coord place;
schar typ;
schar typ; /* from struct rm */
uchar flags; /* also from struct rm; an unsigned 5-bit field there */
};
/* for bones levels: identify the dead character, who might have died on