From: nethack.rankin Date: Sun, 13 Aug 2006 06:03:23 +0000 (+0000) Subject: fix #H167 - entering monster filled level X-Git-Tag: MOVE2GIT~931 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e8c4b08d4e2af956738ec53e3d52380594794da;p=nethack fix #H167 - entering monster filled level When the hero arrives on a level and a monster at his destination can't be relocated to make room for him, goto_level() would place the hero on top of the monster. From a bug report, who said that the game panicked (without providing specifics, at least so far). I wasn't able to reproduce a panic but get a pair of impossible warnings and can confirm that there is a monster on the same spot as the hero, which could easily lead to strangeness depending upon what actions the monster attempts to perform. This fix causes a non-relocateable monster in that situation to be moved to the migrating monsters list for later arrival back on that same level. That's inconsistant with the migrating monster arrival routine, which kills off any monster it can't place; I'm not sure which action is more reasonable, deferred arrival or outright removal. There are three or four dozen ``(void) rloc(mon)'' calls which don't do anything special when rloc fails to move the monster. Those need to be reviewed and the ones where it's making a space for some other monster have to do something about failure. (Failed teleport attempts can simply leave the monster in place, so most of those calls won't need any extra handling.) --- diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 408d3a4f5..14e23f4be 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -246,6 +246,8 @@ in the quest, if the locate level hasn't been reached yet, don't fall or randomly teleport past it fix phrasing in monster against monster attack feedback when attacker is wielding stacked weapons +don't place hero on top of monster when arriving on level which is so full + that the monster can't be moved out of the way Platform- and/or Interface-Specific Fixes diff --git a/src/do.c b/src/do.c index faa11fce4..7e60a1e50 100644 --- a/src/do.c +++ b/src/do.c @@ -1296,8 +1296,16 @@ boolean at_stairs, falling, portal; mnexto(mtmp); if ((mtmp = m_at(u.ux, u.uy)) != 0) { - impossible("mnexto failed (do.c)?"); - (void) rloc(mtmp, FALSE); +#ifdef WIZARD + /* there was an unconditional impossible("mnearto failed") + here, but it's not impossible and we're prepared to cope + with the situation, so only say something when debugging */ + if (wizard) pline("(monster in hero's way)"); +#endif + if (!rloc(mtmp, TRUE)) + /* no room to move it; send it away, to return later */ + migrate_to_level(mtmp, ledger_no(&u.uz), + MIGR_RANDOM, (coord *)0); } }