Engraving sanity checking

This commit is contained in:
Pasi Kallinen
2023-03-18 07:30:25 +02:00
parent 0d9801e17f
commit f360dee4dd
4 changed files with 35 additions and 0 deletions

View File

@@ -1376,6 +1376,34 @@ sanitize_engravings(void)
}
}
void
engraving_sanity_check(void)
{
struct engr *ep;
schar typ;
if (head_engr && (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))) {
impossible("engraving sanity: on plane of air/water");
return;
}
for (ep = head_engr; ep; ep = ep->nxt_engr) {
coordxy x = ep->engr_x, y = ep->engr_y;
if (!isok(x, y)) {
impossible("engraving sanity: !isok <%i,%i>", x, y);
return;
}
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;
}
}
}
void
save_engravings(NHFILE *nhfp)
{