fix #H7677 - guard placed twice at <0,0>
"Placing monster over another?" warning was triggered for vault guard by an earlier change which made m_detach() stop removing monsters at <0,*> from level.monsters[][]. So one guard would replace another at <0,0> for however many guards were created, and memory for all but the last one would be lost. This involved a lot of flailing about and the patch includes various things would could have been discarded. One or two extended monster sanity checks are included, plus a couple of debugpline()'s for tracking guard movement.
This commit is contained in:
+7
-1
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 steed.c $NHDT-Date: 1543543362 2018/11/30 02:02:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
|
||||
/* NetHack 3.6 steed.c $NHDT-Date: 1544608468 2018/12/12 09:54:28 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */
|
||||
/* Copyright (c) Kevin Hugo, 1998-1999. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -742,6 +742,12 @@ place_monster(mon, x, y)
|
||||
struct monst *mon;
|
||||
int x, y;
|
||||
{
|
||||
/* normal map bounds are <1..COLNO-1,0..ROWNO-1> but sometimes
|
||||
vault guards (either living or dead) are parked at <0,0> */
|
||||
if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) {
|
||||
impossible("trying to place monster at <%d,%d>", x, y);
|
||||
x = y = 0;
|
||||
}
|
||||
if (mon == u.usteed
|
||||
/* special case is for convoluted vault guard handling */
|
||||
|| (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
|
||||
|
||||
Reference in New Issue
Block a user