MCPcopy Create free account
hub / github.com/NetHack/NetHack / clear_fcorr

Function clear_fcorr

src/vault.c:47–116  ·  view source on GitHub ↗

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 */

Source from the content-addressed store, hash-verified

45 maintained by guard 'grd'; if guard is still in it, removal will fail,
46 to be tried again later */
47staticfn boolean
48clear_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;

Callers 3

restfakecorrFunction · 0.85
grddeadFunction · 0.85
gd_moveFunction · 0.85

Calls 13

on_levelFunction · 0.85
in_fcorridorFunction · 0.85
yelpFunction · 0.85
rlocFunction · 0.85
m_into_limboFunction · 0.85
t_atFunction · 0.85
deltrapFunction · 0.85
blackoutFunction · 0.85
del_engr_atFunction · 0.85
map_locationFunction · 0.85
recalc_block_pointFunction · 0.85
pline_TheFunction · 0.85

Tested by

no test coverage detected