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

Function gd_move_cleanup

src/vault.c:835–866  ·  view source on GitHub ↗

return 1: guard moved, -2: died */

Source from the content-addressed store, hash-verified

833
834/* return 1: guard moved, -2: died */
835staticfn int
836gd_move_cleanup(
837 struct monst *grd,
838 boolean semi_dead,
839 boolean disappear_msg_seen)
840{
841 int x, y;
842 boolean see_guard;
843
844 /*
845 * The following is a kludge. We need to keep the guard around in
846 * order to be able to make the fake corridor disappear as the
847 * player moves out of it, but we also need the guard out of the
848 * way. We send the guard to never-never land. We set ogx ogy to
849 * mx my in order to avoid a check at the top of this function.
850 * At the end of the process, the guard is killed in restfakecorr().
851 */
852 x = grd->mx, y = grd->my;
853 see_guard = canspotmon(grd);
854 parkguard(grd); /* move to <0,0> */
855 wallify_vault(grd);
856 restfakecorr(grd);
857 debugpline2("gd_move_cleanup: %scleanup%s",
858 grd->isgd ? "" : "final ",
859 grd->isgd ? " attempt" : "");
860 if (!semi_dead && (in_fcorridor(grd, u.ux, u.uy) || cansee(x, y))) {
861 if (!disappear_msg_seen && see_guard)
862 pline("Suddenly, %s disappears.", noit_mon_nam(grd));
863 return 1;
864 }
865 return -2;
866}
867
868staticfn void
869gd_letknow(struct monst *grd)

Callers 1

gd_moveFunction · 0.85

Calls 6

parkguardFunction · 0.85
wallify_vaultFunction · 0.85
restfakecorrFunction · 0.85
in_fcorridorFunction · 0.85
noit_mon_namFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected