display buglet: newsym(0,0)

Starting a new game as a monk was calling newsym(0,0).

<0,0> is within array bounds but off the map.  Have newsym() check the
coordinates it receives.
This commit is contained in:
PatR
2026-04-23 12:07:31 -07:00
parent 93ab8405d8
commit 020604291d
3 changed files with 22 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1614 $ $NHDT-Date: 1769342601 2026/01/25 04:03:21 $ NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1649 $ $NHDT-Date: 1777000050 2026/04/23 19:07:30 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -1598,6 +1598,10 @@ prevent selecting all options in #optionsfull menu
shapeshifters change shape less shapeshifters change shape less
rolling boulder traps aren't removed when stepped on and move boulders rolling boulder traps aren't removed when stepped on and move boulders
pushed onto them pushed onto them
when starting a new game as a monk, newsym(0,0) was being called (adjabil ->
postadjabil -> see_monsters when initializing See_invisible as hero
became level 1; seen 'monster' was the hero who hadn't been placed
on the map yet)
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 attrib.c $NHDT-Date: 1754979443 2025/08/11 22:17:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ /* NetHack 3.7 attrib.c $NHDT-Date: 1777000050 2026/04/23 19:07:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.137 $ */
/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ /* Copyright 1988, 1989, 1990, 1992, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -107,7 +107,7 @@ static const struct innate {
staticfn void exerper(void); staticfn void exerper(void);
staticfn int rnd_attr(void); staticfn int rnd_attr(void);
staticfn int init_attr_role_redist(int, boolean); staticfn int init_attr_role_redist(int, boolean);
staticfn void postadjabil(long *); staticfn void postadjabil(long *) NONNULLARG1;
staticfn const struct innate *role_abil(int); staticfn const struct innate *role_abil(int);
staticfn const struct innate *check_innate_abil(long *, long); staticfn const struct innate *check_innate_abil(long *, long);
staticfn int innately(long *); staticfn int innately(long *);
@@ -779,7 +779,7 @@ staticfn
void void
postadjabil(long *ability) postadjabil(long *ability)
{ {
if (!ability) if (!u.ulevel) /* initializing hero; don't attempt screen update yet */
return; return;
if (ability == &(HWarning) || ability == &(HSee_invisible)) if (ability == &(HWarning) || ability == &(HSee_invisible))
see_monsters(); see_monsters();

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 display.c $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.260 $ */ /* NetHack 3.7 display.c $NHDT-Date: 1777000050 2026/04/23 19:07:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.263 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */ /* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -753,10 +753,9 @@ feel_location(coordxy x, coordxy y)
/* replicate safeguards used by newsym(); might not be required here */ /* replicate safeguards used by newsym(); might not be required here */
if (_suppress_map_output()) if (_suppress_map_output())
return; return;
if (!isok(x, y)) if (!isok(x, y))
return; return;
lev = &(levl[x][y]); lev = &levl[x][y];
/* If hero's memory of an invisible monster is accurate, we want to keep /* If hero's memory of an invisible monster is accurate, we want to keep
* him from detecting the same monster over and over again on each turn. * him from detecting the same monster over and over again on each turn.
* We must return (so we don't erase the monster). (We must also, in the * We must return (so we don't erase the monster). (We must also, in the
@@ -917,15 +916,24 @@ feel_location(coordxy x, coordxy y)
void void
newsym(coordxy x, coordxy y) newsym(coordxy x, coordxy y)
{ {
struct rm *lev;
struct engr *ep;
struct monst *mon; struct monst *mon;
int see_it; int see_it;
boolean worm_tail; boolean worm_tail;
struct rm *lev = &(levl[x][y]);
struct engr *ep;
/* don't try to produce map output when level is in a state of flux */ /* don't try to produce map output when level is in a state of flux */
if (_suppress_map_output()) if (_suppress_map_output())
return; return;
/* should never happen; same error handling as u_on_newpos() */
if (!isok(x, y)) {
void (*errfunc)(const char *, ...) PRINTF_F_PTR(1, 2);
errfunc = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic
: impossible; /* misuse of column 0 is less severe */
(*errfunc)("newsym: attempting screen update for <%d,%d>", x, y);
return;
}
/* only permit updating the hero when swallowed */ /* only permit updating the hero when swallowed */
if (u.uswallow) { if (u.uswallow) {
@@ -939,6 +947,7 @@ newsym(coordxy x, coordxy y)
if (!(is_pool_or_lava(x, y) || is_ice(x, y)) || !next2u(x, y)) if (!(is_pool_or_lava(x, y) || is_ice(x, y)) || !next2u(x, y))
return; return;
} }
lev = &levl[x][y];
/* Can physically see the location. */ /* Can physically see the location. */
if (cansee(x, y)) { if (cansee(x, y)) {