yet another warning bit

In file included from ../include/hack.h:34,
                 from sp_lev.c:14:
In function ‘create_monster’,
    inlined from ‘lspo_monster’ at sp_lev.c:3386:5:
../include/rm.h:528:32: warning: array subscript -1 is below array bounds of ‘struct monst *[80][21]’ [-Warray-bounds=]
  528 |         if (!svl.level.monsters[x][y])                     \
      |              ~~~~~~~~~~~~~~~~~~^~~
sp_lev.c:2045:25: note: in expansion of macro ‘remove_monster’
 2045 |                         remove_monster(x, y);
      |                         ^~~~~~~~~~~~~~
../include/rm.h: In function ‘lspo_monster’:
../include/rm.h:476:19: note: while referencing ‘monsters’
  476 |     struct monst *monsters[COLNO][ROWNO];
      |                   ^~~~~~~~
In function ‘create_monster’,
    inlined from ‘lspo_monster’ at sp_lev.c:3386:5:
../include/rm.h:530:27: warning: array subscript -1 is below array bounds of ‘struct monst *[80][21]’ [-Warray-bounds=]
  530 |         svl.level.monsters[x][y] = (struct monst *) 0;     \
      |         ~~~~~~~~~~~~~~~~~~^~~
sp_lev.c:2045:25: note: in expansion of macro ‘remove_monster’
 2045 |                         remove_monster(x, y);
      |                         ^~~~~~~~~~~~~~
../include/rm.h: In function ‘lspo_monster’:
../include/rm.h:476:19: note: while referencing ‘monsters’
  476 |     struct monst *monsters[COLNO][ROWNO];
      |                   ^~~~~~~~
This commit is contained in:
nhmall
2026-06-26 15:21:19 -04:00
parent 2b2f949484
commit 6fee8a4e78
+2 -1
View File
@@ -2042,7 +2042,8 @@ create_monster(monster *m, struct mkroom *croom)
&& m_bad_boulder_spot(x, y)) {
int retrylimit = 10;
remove_monster(x, y);
if (x >= 0)
remove_monster(x, y);
do {
x = m->x;
y = m->y;