improve full level handling in the endgame

Even though a goodpos failure in mnearto() would return 0 to
the caller and trigger proper overcrowding handling for mtmp,
the 'othermon' would be left with its mx,my set to 0,0 under
that circumstance and then trigger a mon_sanity_check()
failure and accompanying impossible() message a short while
afterwards.

This also includes the addition of some flags that proved useful
for troubleshooting the mystery sanity_check failure and helping
to understand some of the code paths the struct monst data had
been through. They are only used for inspection when issues are
reported or when debugging, they don't presently control the
code flow.  Their setting and use is done in an overloaded way
that should not intrude on the existing use of mspare1 for
MIGR_LEFTOVERS. mon->mstate is just a pseudonym for mon->mspare1
and does not alter save file content.
This commit is contained in:
nhmall
2019-06-01 16:51:10 -04:00
parent 6f7089de10
commit 5ee78c5204
6 changed files with 210 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 monst.h $NHDT-Date: 1550524559 2019/02/18 21:15:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.28 $ */
/* NetHack 3.6 monst.h $NHDT-Date: 1559422218 2019/06/01 20:50:18 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.31 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2016. */
/* NetHack may be freely redistributed. See license for details. */
@@ -50,6 +50,17 @@ enum m_ap_types {
M_AP_MONSTER = 3 /* a monster; mostly used for cloned Wizard */
};
#define MON_FLOOR 0x00
#define MON_OFFMAP 0x01
#define MON_DETACH 0x02
#define MON_MIGRATING 0x04
#define MON_LIMBO 0x08
#define MON_BUBBLEMOVE 0x10
#define MON_ENDGAME_FREE 0x20
#define MON_ENDGAME_MIGR 0x40
#define MON_OBLITERATE 0x80
#define MSTATE_MASK 0xFF
#define M_AP_TYPMASK 0x7
#define M_AP_F_DKNOWN 0x8
#define U_AP_TYPE (youmonst.m_ap_type & M_AP_TYPMASK)
@@ -149,8 +160,8 @@ struct monst {
long mtrapseen; /* bitmap of traps we've been trapped in */
long mlstmv; /* for catching up with lost time */
long mspare1;
#define mstate mspare1 /* only for debug exam right now, not code flow */
struct obj *minvent; /* mon's inventory */
struct obj *mw; /* mon's weapon */
long misc_worn_check; /* mon's wornmask */
xchar weapon_check; /* flag for whether to try switching weapons */