try to remove the temporary corridor (from vault to rest of map) being maintained by guard 'grd'; if guard is still in it, removal will fail, to be tried again later */
| 45 | maintained by guard 'grd'; if guard is still in it, removal will fail, |
| 46 | to be tried again later */ |
| 47 | staticfn boolean |
| 48 | clear_fcorr(struct monst *grd, boolean forceshow) |
| 49 | { |
| 50 | coordxy fcx, fcy, fcbeg; |
| 51 | struct monst *mtmp; |
| 52 | boolean sawcorridor = FALSE, |
| 53 | silently = program_state.stopprint ? TRUE : FALSE; |
| 54 | struct egd *egrd = EGD(grd); |
| 55 | struct trap *trap; |
| 56 | struct rm *lev; |
| 57 | |
| 58 | if (!on_level(&egrd->gdlevel, &u.uz)) |
| 59 | return TRUE; |
| 60 | |
| 61 | /* note: guard remains on 'fmon' list (alive or dead, at off-map |
| 62 | coordinate <0,0>), until temporary corridor from vault back to |
| 63 | civilization has been removed */ |
| 64 | while ((fcbeg = egrd->fcbeg) < egrd->fcend) { |
| 65 | fcx = egrd->fakecorr[fcbeg].fx; |
| 66 | fcy = egrd->fakecorr[fcbeg].fy; |
| 67 | if ((DEADMONSTER(grd) || !in_fcorridor(grd, u.ux, u.uy)) |
| 68 | && egrd->gddone) |
| 69 | forceshow = TRUE; |
| 70 | if ((u_at(fcx, fcy) && !DEADMONSTER(grd)) |
| 71 | || (!forceshow && couldsee(fcx, fcy)) |
| 72 | || (Punished && !carried(uball) && uball->ox == fcx |
| 73 | && uball->oy == fcy)) |
| 74 | return FALSE; |
| 75 | |
| 76 | if ((mtmp = m_at(fcx, fcy)) != 0) { |
| 77 | if (mtmp->isgd) { |
| 78 | return FALSE; |
| 79 | } else { |
| 80 | if (mtmp->mtame) |
| 81 | yelp(mtmp); |
| 82 | if (!rloc(mtmp, RLOC_MSG)) |
| 83 | m_into_limbo(mtmp); |
| 84 | } |
| 85 | } |
| 86 | lev = &levl[fcx][fcy]; |
| 87 | if (lev->typ == CORR && cansee(fcx, fcy)) |
| 88 | sawcorridor = TRUE; |
| 89 | lev->typ = egrd->fakecorr[fcbeg].ftyp; |
| 90 | lev->flags = egrd->fakecorr[fcbeg].flags; |
| 91 | if (IS_STWALL(lev->typ)) { |
| 92 | /* destroy any trap here (pit dug by you, hole dug via |
| 93 | wand while levitating or by monster, bear trap or land |
| 94 | mine via object, spun web) when spot reverts to stone */ |
| 95 | if ((trap = t_at(fcx, fcy)) != 0) |
| 96 | deltrap(trap); |
| 97 | /* undo scroll/wand/spell of light affecting this spot */ |
| 98 | if (lev->typ == STONE) |
| 99 | blackout(fcx, fcy); |
| 100 | } |
| 101 | del_engr_at(fcx, fcy); |
| 102 | map_location(fcx, fcy, 1); /* bypass vision */ |
| 103 | recalc_block_point(fcx, fcy); |
| 104 | gv.vision_full_recalc = 1; |
no test coverage detected