From: Pasi Kallinen Date: Sat, 17 Nov 2018 17:59:09 +0000 (+0200) Subject: Fix vault guard not considering monsters in walls X-Git-Tag: nmake-explicit-path~164 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=657f55782177b0d60a52997f0a9f2b6ea7d97fb0;p=nethack Fix vault guard not considering monsters in walls Two different cases here: a) Vault guard did not move away monsters except if they were standing on gold, and b) moving away monsters on a completely filled level did not work --- diff --git a/src/vault.c b/src/vault.c index eea24737d..32bffdb7a 100644 --- a/src/vault.c +++ b/src/vault.c @@ -13,6 +13,7 @@ STATIC_DCL void FDECL(restfakecorr, (struct monst *)); STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int)); STATIC_DCL void FDECL(move_gold, (struct obj *, int)); STATIC_DCL void FDECL(wallify_vault, (struct monst *)); +STATIC_DCL void FDECL(gd_mv_monaway, (struct monst *, int, int)); void newegd(mtmp) @@ -577,6 +578,19 @@ struct monst *grd; } } +STATIC_OVL void +gd_mv_monaway(grd, nx,ny) +register struct monst *grd; +int nx,ny; +{ + if (MON_AT(nx, ny) && nx != grd->mx && ny != grd->my) { + if (!Deaf) + verbalize("Out of my way, scum!"); + if (!rloc(m_at(nx, ny), FALSE)) + m_into_limbo(m_at(nx, ny)); + } +} + /* * return 1: guard moved, 0: guard didn't, -1: let m_move do it, -2: died */ @@ -745,11 +759,7 @@ register struct monst *grd; mpickgold(grd); /* does a newsym */ } else { /* just for insurance... */ - if (MON_AT(m, n) && m != grd->mx && n != grd->my) { - if (!Deaf) - verbalize("Out of my way, scum!"); - (void) rloc(m_at(m, n), FALSE); - } + gd_mv_monaway(grd, m,n); remove_monster(grd->mx, grd->my); newsym(grd->mx, grd->my); place_monster(grd, m, n); @@ -869,6 +879,7 @@ proceed: fcp->fy = ny; fcp->ftyp = typ; newpos: + gd_mv_monaway(grd, nx,ny); if (egrd->gddone) { /* The following is a kludge. We need to keep */ /* the guard around in order to be able to make */