buglist - full level triggers impossible() from migrating mons
<email deleted> wrote: > If more monsters fall through a trap door than can fit on the > level below, when you go down the stairs, you get the following > message: > "Program in disorder - perhaps you'd better #quit. > rloc(): couldn't relocate monster" > This message seems to appear once for every monster-too-many that > fell through the hole. I originally found this while > intentionally completely filling a level with black puddings > (there was a trap door I didn't know about). I also confirmed it > in a wiz-mode test using gremlins and water. [confirmed: moveloop -> deferred_goto -> goto_level -> losedogs -> mon_arrive -> rloc -> impossible] This patch: - causes rloc() to return TRUE if successful, or FALSE if it wasn't. - adds code to mon_arrive() in dog.c to deal with the failed rloc() - allows the x,y parameters to mkcorpstat() to be 0,0 in order to trigger random placement of the corpse on the level - if you define DEBUG_MIGRATING_MONS when you build cmd.c then you'll have a debug-mode command #migratemons to store the number of random monsters that you specify on the migrating monsters chain.
This commit is contained in:
+13
-9
@@ -953,16 +953,18 @@ register int x, y;
|
||||
}
|
||||
|
||||
/* place a monster at a random location, typically due to teleport */
|
||||
void
|
||||
rloc(mtmp)
|
||||
/* return TRUE if successful, FALSE if not */
|
||||
boolean
|
||||
rloc(mtmp, suppress_impossible)
|
||||
struct monst *mtmp; /* mx==0 implies migrating monster arrival */
|
||||
boolean suppress_impossible;
|
||||
{
|
||||
register int x, y, trycount;
|
||||
|
||||
#ifdef STEED
|
||||
if (mtmp == u.usteed) {
|
||||
tele();
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -996,11 +998,13 @@ struct monst *mtmp; /* mx==0 implies migrating monster arrival */
|
||||
goto found_xy;
|
||||
|
||||
/* level either full of monsters or somehow faulty */
|
||||
impossible("rloc(): couldn't relocate monster");
|
||||
return;
|
||||
if (!suppress_impossible)
|
||||
impossible("rloc(): couldn't relocate monster");
|
||||
return FALSE;
|
||||
|
||||
found_xy:
|
||||
rloc_to(mtmp, x, y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
@@ -1015,7 +1019,7 @@ struct monst *mtmp;
|
||||
rloc_to(mtmp, c.x, c.y);
|
||||
return;
|
||||
}
|
||||
rloc(mtmp);
|
||||
(void) rloc(mtmp, FALSE);
|
||||
}
|
||||
|
||||
boolean
|
||||
@@ -1049,7 +1053,7 @@ int in_sight;
|
||||
* the guard isn't going to come for it...
|
||||
*/
|
||||
if (trap->once) mvault_tele(mtmp);
|
||||
else rloc(mtmp);
|
||||
else (void) rloc(mtmp, FALSE);
|
||||
|
||||
if (in_sight) {
|
||||
if (canseemon(mtmp))
|
||||
@@ -1253,12 +1257,12 @@ boolean give_feedback;
|
||||
if (give_feedback)
|
||||
You("are no longer inside %s!", mon_nam(mtmp));
|
||||
unstuck(mtmp);
|
||||
rloc(mtmp);
|
||||
(void) rloc(mtmp, FALSE);
|
||||
} else if (is_rider(mtmp->data) && rn2(13) &&
|
||||
enexto(&cc, u.ux, u.uy, mtmp->data))
|
||||
rloc_to(mtmp, cc.x, cc.y);
|
||||
else
|
||||
rloc(mtmp);
|
||||
(void) rloc(mtmp, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user