]> granicus.if.org Git - nethack/commitdiff
fix #H167 - entering monster filled level
authornethack.rankin <nethack.rankin>
Sun, 13 Aug 2006 06:03:23 +0000 (06:03 +0000)
committernethack.rankin <nethack.rankin>
Sun, 13 Aug 2006 06:03:23 +0000 (06:03 +0000)
     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.)

doc/fixes34.4
src/do.c

index 408d3a4f5c1f1a4c558b9ee6ecbf11b06f7b5246..14e23f4bec2607dc08412a4b02ef6eaaa5ff5065 100644 (file)
@@ -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
index faa11fce43a23ddb6de4db003792bb9bb2b273c3..7e60a1e508686367ca8ebec5945a0cbf64dcbfdb 100644 (file)
--- 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);
            }
        }