Engraving sanity checking
This commit is contained in:
@@ -827,6 +827,7 @@ extern void del_engr_at(coordxy, coordxy);
|
|||||||
extern int freehand(void);
|
extern int freehand(void);
|
||||||
extern int doengrave(void);
|
extern int doengrave(void);
|
||||||
extern void sanitize_engravings(void);
|
extern void sanitize_engravings(void);
|
||||||
|
extern void engraving_sanity_check(void);
|
||||||
extern void save_engravings(NHFILE *);
|
extern void save_engravings(NHFILE *);
|
||||||
extern void rest_engravings(NHFILE *);
|
extern void rest_engravings(NHFILE *);
|
||||||
extern void engr_stats(const char *, char *, long *, long *);
|
extern void engr_stats(const char *, char *, long *, long *);
|
||||||
|
|||||||
@@ -4247,6 +4247,7 @@ sanity_check(void)
|
|||||||
light_sources_sanity_check();
|
light_sources_sanity_check();
|
||||||
bc_sanity_check();
|
bc_sanity_check();
|
||||||
trap_sanity_check();
|
trap_sanity_check();
|
||||||
|
engraving_sanity_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* qsort() comparison routine for use in list_migrating_mons() */
|
/* qsort() comparison routine for use in list_migrating_mons() */
|
||||||
|
|||||||
@@ -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
|
void
|
||||||
save_engravings(NHFILE *nhfp)
|
save_engravings(NHFILE *nhfp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ map_cleanup(void)
|
|||||||
{
|
{
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
struct trap *ttmp;
|
struct trap *ttmp;
|
||||||
|
struct engr *etmp;
|
||||||
coordxy x, y;
|
coordxy x, y;
|
||||||
|
|
||||||
for (x = 0; x < COLNO; x++)
|
for (x = 0; x < COLNO; x++)
|
||||||
@@ -347,6 +348,10 @@ map_cleanup(void)
|
|||||||
if (((ttmp = t_at(x, y)) != 0)
|
if (((ttmp = t_at(x, y)) != 0)
|
||||||
&& !undestroyable_trap(ttmp->ttyp))
|
&& !undestroyable_trap(ttmp->ttyp))
|
||||||
deltrap(ttmp);
|
deltrap(ttmp);
|
||||||
|
|
||||||
|
/* engravings? */
|
||||||
|
if ((etmp = engr_at(x, y)) != 0)
|
||||||
|
del_engr(etmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user