fix broken migrating monster arrival
If the first monster on the migrating_mons list couldn't arrive and was put back on the list to try again later, 'later' would happen immediately and the program looped forever trying and failing to bring that monster to the level. Defer repeat attempts at migration until losedogs() has been through the whole migrating_mons list. mon_arrive() now populates a new list called failed_arrivals and losedog() moves its contents, if any, to migrating_mons prior to returning.
This commit is contained in:
@@ -215,10 +215,12 @@ findgd(void)
|
||||
for (mprev = &g.migrating_mons; (mtmp = *mprev) != 0;
|
||||
mprev = &mtmp->nmon) {
|
||||
if (mtmp->isgd && on_level(&EGD(mtmp)->gdlevel, &u.uz)) {
|
||||
/* take out of migrating_mons and place at <0,0> */
|
||||
/* take out of migrating_mons and place at <0,0>;
|
||||
simplified mon_arrive(); avoid that because it would
|
||||
send mtmp into limbo if no regular map spot is available */
|
||||
*mprev = mtmp->nmon;
|
||||
/* simplified mon_arrive(); avoid that because it would send
|
||||
mtmp into limbo if no regular map spot is available */
|
||||
mtmp->nmon = fmon;
|
||||
fmon = mtmp;
|
||||
mon_track_clear(mtmp);
|
||||
mtmp->mux = u.ux, mtmp->muy = u.uy;
|
||||
mtmp->mx = mtmp->my = 0; /* not on map (note: mx is already 0) */
|
||||
|
||||
Reference in New Issue
Block a user