already a different monster on the same square, then treat it like a monster trying to unsubmerge from underneath the player. Also give an error message (with a reference to the bug number) since two monsters aren't supposed to be on the same square.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7532 c06c8d41-db1a-0410-9941-cceddc491573
GN3X2AI373HZRX53EQEWSILYEAMKBJBN4NKW5CT7PHYKPEWOPX4AC
B62LRY6EDGLIYGZCQC6UG76KGGCHQZUP6ZDFBPSWYF352ULQJQOQC
2UO6ZOW7UCP5XJ2TJ26PJNQABILK2BZ4J3BAKLOKMZPJDQHW24MAC
FVEPL7AUMO6QPLVPGQVZTPSI5ITBIW6Q7CYUWQYGVNUHKTK5FQHAC
AV3TMWHWB3XBXQCT34UPMZBSIIKVXIGWQPNEFU4CZSBS3ZOF2CUQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SIDH2P7NBIG5KEOE27XHD3ZT2NQ2OJZFN6VZXWNWYFFY5YVXSSVQC
// Monster un-submerging while under player. Try to move to an
// adjacent square in which the monster could have been submerged
// and have it unsubmerge from there.
if (midx != mgrd(mon->pos()))
{
monsters* other_mon = &menv[mgrd(mon->pos())];
if (other_mon->type == -1 || other_mon->type == NON_MONSTER)
{
mgrd(mon->pos()) = midx;
mprf(MSGCH_ERROR, "mgrd(%d,%d) points to dead monster, even "
"though it contains submerged monster %s (see bug 2293518)",
mon->pos().x, mon->pos().y,
mon->name(DESC_PLAIN, true).c_str());
if (mon->pos() != you.pos())
return (true);
}
else
mprf(MSGCH_ERROR, "%s tried to unsubmerge while on same square as "
"%s (see bug 2293518)", mon->name(DESC_CAP_THE, true).c_str(),
mon->name(DESC_NOCAP_A, true).c_str());
}
// Monster un-submerging while under player or another monster. Try to
// move to an adjacent square in which the monster could have been
// submerged and have it unsubmerge from there.