Skip to content

Commit

Permalink
fix #H167 - entering monster filled level
Browse files Browse the repository at this point in the history
     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.)
  • Loading branch information
nethack.rankin committed Aug 13, 2006
1 parent c91c9ad commit 2e8c4b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/fixes34.4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions src/do.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 2e8c4b0

Please sign in to comment.