place_monster() debugging
Show more information if place_monster() detects something wrong. I don't know whether it will actually be useful.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 do_name.c $NHDT-Date: 1560611967 2019/06/15 15:19:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */
|
||||
/* NetHack 3.6 do_name.c $NHDT-Date: 1573940540 2019/11/16 21:42:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.150 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Pasi Kallinen, 2018. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1978,6 +1978,42 @@ struct monst *mon, *other_mon;
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/* for debugging messages, where data might be suspect and we aren't
|
||||
taking what the hero does or doesn't know into consideration */
|
||||
char *
|
||||
minimal_monnam(mon, ckloc)
|
||||
struct monst *mon;
|
||||
boolean ckloc;
|
||||
{
|
||||
struct permonst *ptr;
|
||||
char *outbuf = nextmbuf();
|
||||
|
||||
if (!mon) {
|
||||
Strcpy(outbuf, "[Null monster]");
|
||||
} else if ((ptr = mon->data) == 0) {
|
||||
Strcpy(outbuf, "[Null mon->data]");
|
||||
} else if (ptr < &mons[0]) {
|
||||
Sprintf(outbuf, "[Invalid mon->data %s < %s]",
|
||||
fmt_ptr((genericptr_t) mon->data),
|
||||
fmt_ptr((genericptr_t) &mons[0]));
|
||||
} else if (ptr >= &mons[NUMMONS]) {
|
||||
Sprintf(outbuf, "[Invalid mon->data %s >= %s]",
|
||||
fmt_ptr((genericptr_t) mon->data),
|
||||
fmt_ptr((genericptr_t) &mons[NUMMONS]));
|
||||
} else if (ckloc && ptr == &mons[PM_LONG_WORM]
|
||||
&& level.monsters[mon->mx][mon->my] != mon) {
|
||||
Sprintf(outbuf, "%s <%d,%d>",
|
||||
mons[PM_LONG_WORM_TAIL].mname, mon->mx, mon->my);
|
||||
} else {
|
||||
Sprintf(outbuf, "%s%s <%d,%d>",
|
||||
mon->mtame ? "tame " : mon->mpeaceful ? "peaceful " : "",
|
||||
mon->data->mname, mon->mx, mon->my);
|
||||
if (mon->cham != NON_PM)
|
||||
Sprintf(eos(outbuf), "{%s}", mons[mon->cham].mname);
|
||||
}
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/* fake monsters used to be in a hard-coded array, now in a data file */
|
||||
STATIC_OVL char *
|
||||
bogusmon(buf, code)
|
||||
|
||||
Reference in New Issue
Block a user