diff --git a/doc/fixes36.3 b/doc/fixes36.3 index bf389167d..82ada4627 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -42,6 +42,8 @@ some improvement to the handling of endgame levels filling up with monsters Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository ------------------------------------------------------------------ +elemental_clog() loop needed to guard against obliteration of the monster + that was trying to be placed curses: sometimes the message window would show a blank line after a prompt diff --git a/src/dungeon.c b/src/dungeon.c index eff67af3a..8cf395abe 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.c $NHDT-Date: 1558853012 2019/05/26 06:43:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.94 $ */ +/* NetHack 3.6 dungeon.c $NHDT-Date: 1559476918 2019/06/02 12:01:58 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.95 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1185,6 +1185,13 @@ void u_on_newpos(x, y) int x, y; { + if (!isok(x, y)) { /* validate location */ + void VDECL((*func), (const char *, ...)) PRINTF_F(1, 2); + + func = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic + : impossible; + (*func)("u_on_newpos: trying to place hero off map <%d,%d>", x, y); + } u.ux = x; u.uy = y; #ifdef CLIPPING diff --git a/src/mkobj.c b/src/mkobj.c index eb949d9a9..7501158f8 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkobj.c $NHDT-Date: 1558124913 2019/05/17 20:28:33 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.147 $ */ +/* NetHack 3.6 mkobj.c $NHDT-Date: 1559476922 2019/06/02 12:02:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1723,8 +1723,17 @@ int x, y; { register struct obj *otmp2 = g.level.objects[x][y]; + if (!isok(x, y)) { /* validate location */ + void VDECL((*func), (const char *, ...)) PRINTF_F(1, 2); + + func = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic + : impossible; + (*func)("place_object: \"%s\" [%d] off map <%d,%d>", + safe_typename(otmp->otyp), otmp->where, x, y); + } if (otmp->where != OBJ_FREE) - panic("place_object: obj not free"); + panic("place_object: obj \"%s\" [%d] not free", + safe_typename(otmp->otyp), otmp->where); obj_no_longer_held(otmp); if (otmp->otyp == BOULDER) { diff --git a/src/mon.c b/src/mon.c index f76f67eee..a385eb7a4 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1845,10 +1845,9 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */ shkgone(mtmp); if (mtmp->wormno) wormgone(mtmp); - if (In_endgame(&u.uz)) { - mtmp->mx = mtmp->my = 0; + if (In_endgame(&u.uz)) mtmp->mstate |= MON_ENDGAME_FREE; - } + mtmp->mstate |= MON_DETACH; iflags.purge_monsters++; } @@ -2633,7 +2632,7 @@ struct monst *mon; m1 = m2 = m3 = m4 = m5 = zm = (struct monst *) 0; if (!msgmv || (g.moves - msgmv) > 200L) { if (!msgmv || rn2(2)) - You("feel besieged."); + You_feel("besieged."); msgmv = g.moves; } /* @@ -2644,7 +2643,7 @@ struct monst *mon; * m5 a pet. */ for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { - if (DEADMONSTER(mtmp)) + if (DEADMONSTER(mtmp) || mtmp == mon) continue; if (mtmp->mx == 0 && mtmp->my == 0) continue; @@ -2679,8 +2678,9 @@ struct monst *mon; mtmp->mstate |= MON_OBLITERATE; mongone(mtmp); - mtmp->mx = mtmp->my = 0; - rloc_to(mon, mx, my); + /* some places in the code might still reference mtmp->mx, mtmp->my */ + /* mtmp->mx = mtmp->my = 0; */ + rloc_to(mon, mx, my); /* note: mon, not mtmp */ } else { /* last resort - migrate mon to the next plane */ if (Is_waterlevel(&u.uz) || Is_firelevel(&u.uz) || Is_earthlevel(&u.uz)) {