From 9ad7268c0a824d654aef35d072cde6e8d28a3262 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 19 Nov 2018 21:24:08 +0200 Subject: [PATCH] Moving long worms may still put tail in old location When using rloc and friends to move monsters, and the monster happens to be a long worm, the tail may get randomly placed in the same place where the long worm was removed from. In the cases where we expect the location to really be free, explicitly recheck the location for a monster after rloc. --- src/do.c | 2 +- src/vault.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/do.c b/src/do.c index 00f0b8edd..29d27a1ce 100644 --- a/src/do.c +++ b/src/do.c @@ -1446,7 +1446,7 @@ boolean at_stairs, falling, portal; with the situation, so only say something when debugging */ if (wizard) pline("(monster in hero's way)"); - if (!rloc(mtmp, TRUE)) + if (!rloc(mtmp, TRUE) || m_at(u.ux, u.uy)) /* no room to move it; send it away, to return later */ migrate_to_level(mtmp, ledger_no(&u.uz), MIGR_RANDOM, (coord *) 0); diff --git a/src/vault.c b/src/vault.c index 32bffdb7a..b3def3bd4 100644 --- a/src/vault.c +++ b/src/vault.c @@ -586,7 +586,7 @@ int nx,ny; if (MON_AT(nx, ny) && nx != grd->mx && ny != grd->my) { if (!Deaf) verbalize("Out of my way, scum!"); - if (!rloc(m_at(nx, ny), FALSE)) + if (!rloc(m_at(nx, ny), FALSE) || m_at(nx, ny)) m_into_limbo(m_at(nx, ny)); } }