fix #K3912 - engraving sanity: closed doors
Engraving in an empty doorway and then using locking magic to create a door there resulted in an impossible warning: "engraving sanity: illegal surface (23)" if the 'sanity_check' option was On (wizard mode only). Engraving in an open doorway and then simply closing the existing door produced the same effect. Accept engravings at closed doors. Presumably hero will be using Passes_walls to attempt that so treat closed doors same as open ones. Update the engraving sanity check to deal with that. Bonus fix: engraving sanity checking stopped after the first problem instead of checking every engraving. Have it continue instead. Not fixed: vault wall repair and temporary corridor removal does not delete engravings and can trigger the illegal surface warning if player engraves before the repairs. I didn't test shop wall repair but it doesn't have any engr references so probably has the same bug.
This commit is contained in:
@@ -1720,10 +1720,12 @@ Can_rise_up(coordxy x, coordxy y, d_level *lev)
|
||||
boolean
|
||||
has_ceiling(d_level *lev)
|
||||
{
|
||||
if (!(Is_astralevel(lev) || Is_firelevel(lev)
|
||||
|| Is_airlevel(lev) || Is_waterlevel(lev)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
/* FIXME: some (most? all?) of the quest home levels are conceptually
|
||||
above ground and don't have ceilings outside of their buildings
|
||||
but we don't presently check for that */
|
||||
if (In_endgame(lev) && !Is_earthlevel(lev))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean
|
||||
@@ -1779,14 +1781,16 @@ const char *
|
||||
surface(coordxy x, coordxy y)
|
||||
{
|
||||
struct rm *lev = &levl[x][y];
|
||||
int levtyp = SURFACE_AT(x, y);
|
||||
|
||||
if (u_at(x, y) && u.uswallow && is_animal(u.ustuck->data))
|
||||
/* 'husk' is iffy but maw is wrong for 't' class */
|
||||
return digests(u.ustuck->data) ? "maw"
|
||||
: enfolds(u.ustuck->data) ? "husk"
|
||||
: "nonesuch"; /* can't happen (fingers crossed...) */
|
||||
else if (IS_AIR(lev->typ) && Is_airlevel(&u.uz))
|
||||
return "air";
|
||||
else if (IS_AIR(levtyp))
|
||||
return Is_waterlevel(&u.uz) ? "air bubble"
|
||||
: (levtyp == CLOUD) ? "cloud" : "air";
|
||||
else if (is_pool(x, y))
|
||||
return (Underwater && !Is_waterlevel(&u.uz))
|
||||
? "bottom" : hliquid("water");
|
||||
@@ -1796,16 +1800,19 @@ surface(coordxy x, coordxy y)
|
||||
return hliquid("lava");
|
||||
else if (lev->typ == DRAWBRIDGE_DOWN)
|
||||
return "bridge";
|
||||
else if (IS_ALTAR(levl[x][y].typ))
|
||||
else if (IS_ALTAR(levtyp))
|
||||
return "altar";
|
||||
else if (IS_GRAVE(levl[x][y].typ))
|
||||
else if (IS_GRAVE(levtyp))
|
||||
return "headstone";
|
||||
else if (IS_FOUNTAIN(levl[x][y].typ))
|
||||
else if (IS_FOUNTAIN(levtyp))
|
||||
return "fountain";
|
||||
else if (On_stairs(x, y))
|
||||
return "stairs";
|
||||
else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz))
|
||||
|| IS_WALL(lev->typ) || IS_DOOR(lev->typ) || lev->typ == SDOOR)
|
||||
else if (IS_WALL(levtyp) || levtyp == SDOOR)
|
||||
return "wall"; /* 'surface' during Passes_walls */
|
||||
else if (IS_DOOR(levtyp))
|
||||
return "doorway"; /* even for closed door */
|
||||
else if (IS_ROOM(levtyp) && !Is_earthlevel(&u.uz))
|
||||
return "floor";
|
||||
else
|
||||
return "ground";
|
||||
|
||||
@@ -407,6 +407,8 @@ stylus_ok(struct obj *obj)
|
||||
static boolean
|
||||
u_can_engrave(void)
|
||||
{
|
||||
int levtyp = SURFACE_AT(u.ux, u.uy);
|
||||
|
||||
if (u.uswallow) {
|
||||
if (is_animal(u.ustuck->data)) {
|
||||
pline("What would you write? \"Jonah was here\"?");
|
||||
@@ -420,18 +422,20 @@ u_can_engrave(void)
|
||||
} else if (is_lava(u.ux, u.uy)) {
|
||||
You_cant("write on the %s!", surface(u.ux, u.uy));
|
||||
return FALSE;
|
||||
} else if (is_pool(u.ux, u.uy) || IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
|
||||
} else if (is_pool(u.ux, u.uy) || IS_FOUNTAIN(levtyp)) {
|
||||
You_cant("write on the %s!", surface(u.ux, u.uy));
|
||||
return FALSE;
|
||||
}
|
||||
if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) /* in bubble */) {
|
||||
You_cant("write in thin air!");
|
||||
} else if (IS_AIR(levtyp)) {
|
||||
/* airlevel or inside bubble on waterlevel */
|
||||
You_cant("write in %s!",
|
||||
(levtyp == CLOUD) ? "cloud vapor" : "thin air");
|
||||
return FALSE;
|
||||
} else if (!accessible(u.ux, u.uy)) {
|
||||
} else if (!ACCESSIBLE(levtyp)) {
|
||||
/* stone, tree, wall, secret corridor, pool, lava, bars */
|
||||
You_cant("write here.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (cantwield(gy.youmonst.data)) {
|
||||
You_cant("even hold anything!");
|
||||
return FALSE;
|
||||
@@ -1315,7 +1319,7 @@ void
|
||||
engraving_sanity_check(void)
|
||||
{
|
||||
struct engr *ep;
|
||||
schar typ;
|
||||
int levtyp;
|
||||
|
||||
if (head_engr && (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) {
|
||||
impossible("engraving sanity: on plane of air/water");
|
||||
@@ -1327,14 +1331,13 @@ engraving_sanity_check(void)
|
||||
|
||||
if (!isok(x, y)) {
|
||||
impossible("engraving sanity: !isok <%i,%i>", x, y);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
typ = levl[x][y].typ;
|
||||
if (typ == LAVAPOOL || typ == LAVAWALL || IS_POOL(typ)
|
||||
|| typ == AIR || !accessible(x, y)) {
|
||||
impossible("engraving sanity: illegal surface (%i)", typ);
|
||||
return;
|
||||
levtyp = SURFACE_AT(x, y);
|
||||
if (is_pool_or_lava(x, y) || IS_AIR(levtyp) || !ACCESSIBLE(levtyp)) {
|
||||
impossible("engraving sanity: illegal surface (%d: \"%s\")",
|
||||
levtyp, surface(x, y));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1895,11 +1895,8 @@ closed_door(coordxy x, coordxy y)
|
||||
boolean
|
||||
accessible(coordxy x, coordxy y)
|
||||
{
|
||||
int levtyp = levl[x][y].typ;
|
||||
|
||||
/* use underlying terrain in front of closed drawbridge */
|
||||
if (levtyp == DRAWBRIDGE_UP)
|
||||
levtyp = db_under_typ(levl[x][y].drawbridgemask);
|
||||
int levtyp = SURFACE_AT(x, y);
|
||||
|
||||
return (boolean) (ACCESSIBLE(levtyp) && !closed_door(x, y));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user