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
This commit is contained in:
Pasi Kallinen
2018-11-19 21:20:43 +02:00
parent ebef31ffa5
commit 657f557821
+16 -5
View File
@@ -13,6 +13,7 @@ STATIC_DCL void FDECL(restfakecorr, (struct monst *));
STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int)); STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *, int, int));
STATIC_DCL void FDECL(move_gold, (struct obj *, int)); STATIC_DCL void FDECL(move_gold, (struct obj *, int));
STATIC_DCL void FDECL(wallify_vault, (struct monst *)); STATIC_DCL void FDECL(wallify_vault, (struct monst *));
STATIC_DCL void FDECL(gd_mv_monaway, (struct monst *, int, int));
void void
newegd(mtmp) 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 * 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 */ mpickgold(grd); /* does a newsym */
} else { } else {
/* just for insurance... */ /* just for insurance... */
if (MON_AT(m, n) && m != grd->mx && n != grd->my) { gd_mv_monaway(grd, m,n);
if (!Deaf)
verbalize("Out of my way, scum!");
(void) rloc(m_at(m, n), FALSE);
}
remove_monster(grd->mx, grd->my); remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my); newsym(grd->mx, grd->my);
place_monster(grd, m, n); place_monster(grd, m, n);
@@ -869,6 +879,7 @@ proceed:
fcp->fy = ny; fcp->fy = ny;
fcp->ftyp = typ; fcp->ftyp = typ;
newpos: newpos:
gd_mv_monaway(grd, nx,ny);
if (egrd->gddone) { if (egrd->gddone) {
/* The following is a kludge. We need to keep */ /* The following is a kludge. We need to keep */
/* the guard around in order to be able to make */ /* the guard around in order to be able to make */