mnearto/mnexto/enexto

This doesn't solve the <0,0> problem but it does prevent mnexto()
from using uninitialized coordinates if enexto() fails.  It also adds
several debugging messages.

enexto() was ignoring map row #0 (unlike column #0, row #0 contains
valid map locations).  Fixing that doesn't matter for Plane of Water
though since that row is stone there--that's probably a bug.  It was
also repeatedly re-testing the top+1 and bottom rows and left and
right columns after they had already failed to be acceptable.  It
still does some of that, but less.
This commit is contained in:
PatR
2019-05-30 07:50:38 -07:00
parent 1a35c15588
commit 791b87833b
4 changed files with 97 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1559088524 2019/05/29 00:08:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.71 $ */
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1559227829 2019/05/30 14:50:29 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.72 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1858,6 +1858,7 @@ boolean ini;
for (olist = (struct obj *) cons->list; olist; olist = otmp) {
otmp = olist->nexthere;
place_object(olist, cons->x, cons->y);
stackobj(olist);
}
break;
}
@@ -1865,7 +1866,12 @@ boolean ini;
case CONS_MON: {
struct monst *mon = (struct monst *) cons->list;
(void) mnearto(mon, cons->x, cons->y, TRUE);
/* mnearto() might fail, and putting the monster into limbo
to try next time hero comes to this level makes no sense
because we can't leave and return (outside wizard mode) */
if (!mnearto(mon, cons->x, cons->y, TRUE)) {
; /* ? */
}
break;
}