diff --git a/include/extern.h b/include/extern.h index 3a0c6183f..f6063cef9 100644 --- a/include/extern.h +++ b/include/extern.h @@ -3502,6 +3502,7 @@ extern int assign_videocolors(char *) NONNULLARG1; /* ### vision.c ### */ +extern boolean get_viz_clear(int, int); extern void vision_init(void); extern int does_block(int, int, struct rm *) NONNULLARG3; extern void vision_reset(void); diff --git a/src/apply.c b/src/apply.c index 60384c3aa..676d97137 100644 --- a/src/apply.c +++ b/src/apply.c @@ -452,6 +452,7 @@ use_stethoscope(struct obj *obj) Soundeffect(se_hollow_sound, 100); You_hear(hollow_str, "door"); cvt_sdoor_to_door(lev); /* ->typ = DOOR */ + recalc_block_point(rx, ry); feel_newsym(rx, ry); return res; case SCORR: diff --git a/src/detect.c b/src/detect.c index ccede5c5d..cb6dc2458 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1651,6 +1651,7 @@ findone(coordxy zx, coordxy zy, genericptr_t whatfound) flash_glyph_at(zx, zy, cmap_to_glyph(sym), FOUND_FLASH_COUNT); cvt_sdoor_to_door(lev); /* set lev->typ = DOOR */ + recalc_block_point(zx, zy); magic_map_background(zx, zy, 0); foundone(zx, zy, back_to_glyph(zx, zy)); found_p->num_sdoors++; @@ -2040,6 +2041,7 @@ dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */ if (rnl(7 - fund)) continue; cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ + recalc_block_point(x, y); exercise(A_WIS, TRUE); nomul(0); feel_location(x, y); /* make sure it shows up */ diff --git a/src/dig.c b/src/dig.c index cb064c53c..2e028b035 100644 --- a/src/dig.c +++ b/src/dig.c @@ -541,6 +541,7 @@ dig(void) if (IS_DOOR(lev->typ) && (lev->doormask & D_TRAPPED)) { lev->doormask = D_NODOOR; b_trapped("door", NO_PART); + recalc_block_point(dpx, dpy); newsym(dpx, dpy); } cleanup: @@ -1682,7 +1683,7 @@ zap_dig(void) pline_The("door is razed!"); watch_dig((struct monst *) 0, zx, zy, TRUE); room->doormask = D_NODOOR; - unblock_point(zx, zy); /* vision */ + recalc_block_point(zx, zy); /* vision */ digdepth -= 2; if (maze_dig) break; diff --git a/src/muse.c b/src/muse.c index 22948330a..264d6b9ab 100644 --- a/src/muse.c +++ b/src/muse.c @@ -758,8 +758,7 @@ reveal_trap(struct trap *t, boolean seeit) if (lev->typ == SCORR) { lev->typ = CORR, lev->flags = 0; /* set_levltyp(,,CORR) */ - if (seeit) - unblock_point(t->tx, t->ty); + unblock_point(t->tx, t->ty); } if (seeit) seetrap(t); diff --git a/src/read.c b/src/read.c index 47c4d2594..831d85118 100644 --- a/src/read.c +++ b/src/read.c @@ -2035,8 +2035,11 @@ seffect_magic_mapping(struct obj **sobjp) for (x = 1; x < COLNO; x++) for (y = 0; y < ROWNO; y++) - if (levl[x][y].typ == SDOOR) + if (levl[x][y].typ == SDOOR) { cvt_sdoor_to_door(&levl[x][y]); + if (Is_rogue_level(&u.uz)) + unblock_point(x, y); + } /* do_mapping() already reveals secret passages */ } gk.known = TRUE; diff --git a/src/vision.c b/src/vision.c index e3d771a04..3f33d726c 100644 --- a/src/vision.c +++ b/src/vision.c @@ -100,6 +100,15 @@ staticfn void rogue_vision(seenV **, coordxy *, coordxy *); #define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0)) #define v_abs(z) ((z) < 0 ? -(z) : (z)) /* don't use abs -- it may exist */ +/* expose viz_clear[][] for sanity checking */ +boolean +get_viz_clear(int x, int y) +{ + if (isok(x,y) && !viz_clear[y][x]) + return TRUE; + return FALSE; +} + /* * vision_init() * diff --git a/src/wizcmds.c b/src/wizcmds.c index 948b63fe6..a22b6883d 100644 --- a/src/wizcmds.c +++ b/src/wizcmds.c @@ -20,6 +20,7 @@ staticfn void mon_chain(winid, const char *, struct monst *, boolean, long *, staticfn void contained_stats(winid, const char *, long *, long *); staticfn void misc_stats(winid, long *, long *); staticfn void you_sanity_check(void); +staticfn void levl_sanity_check(void); staticfn void makemap_unmakemon(struct monst *, boolean); staticfn int QSORTCALLBACK migrsort_cmp(const genericptr, const genericptr); staticfn void list_migrating_mons(d_level *); @@ -1437,6 +1438,22 @@ you_sanity_check(void) (void) check_invent_gold("invent"); } +staticfn void +levl_sanity_check(void) +{ + coordxy x, y; + + if (Underwater) + return; /* Underwater uses different vision */ + + for (y = 0; y < ROWNO; y++) { + for (x = 1; x < COLNO; x++) { + if ((does_block(x, y, &levl[x][y]) ? 1 : 0) != get_viz_clear(x, y)) + impossible("levl[%i][%i] vision blocking", x, y); + } + } +} + void sanity_check(void) { @@ -1457,6 +1474,7 @@ sanity_check(void) bc_sanity_check(); trap_sanity_check(); engraving_sanity_check(); + levl_sanity_check(); program_state.in_sanity_check--; } diff --git a/src/zap.c b/src/zap.c index b367722f3..7fc54146e 100644 --- a/src/zap.c +++ b/src/zap.c @@ -3707,6 +3707,7 @@ zap_map( /* secret door gets revealed, converted into regular door */ if (ltyp == SDOOR) { cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ + recalc_block_point(x, y); newsym(x, y); if (cansee(x, y)) { pline("Probing reveals a secret door."); @@ -5331,6 +5332,7 @@ zap_over_floor( /* secret door gets revealed, converted into regular door */ if (levl[x][y].typ == SDOOR) { cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ + recalc_block_point(x, y); /* target spot will now pass closed_door() test below (except on rogue level) */ newsym(x, y);