aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-04-20 21:00:15 -0400
committerPaul Gilbert2018-04-20 21:00:15 -0400
commit030582af001507e441429fb1f2215fe246198624 (patch)
treeb6acf90296ea417a722c2a27cd92786d8274b9f5
parent4d3a7a78f52867204b4eb104849717266de4ebc0 (diff)
downloadscummvm-rg350-030582af001507e441429fb1f2215fe246198624.tar.gz
scummvm-rg350-030582af001507e441429fb1f2215fe246198624.tar.bz2
scummvm-rg350-030582af001507e441429fb1f2215fe246198624.zip
XEEN: Ignore monster moves outside map rather than asserting
-rw-r--r--engines/xeen/combat.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 3aff7ec730..0678fc0d89 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -716,7 +716,10 @@ void Combat::moveMonster(int monsterId, const Common::Point &moveDelta) {
MazeMonster &monster = map._mobData._monsters[monsterId];
Common::Point newPos = monster._position + moveDelta;
- assert((uint)newPos.x < 32 && (uint)newPos.y < 32);
+ // FIXME: Monster moved outside mapping area. Which shouldn't happen, so ignore the move if it does
+ if ((uint)newPos.x >= 32 || (uint)newPos.y >= 32)
+ return;
+
if (_monsterMap[newPos.y][newPos.x] < 3 && monster._damageType == DT_PHYSICAL && _moveMonsters) {
// Adjust monster's position
++_monsterMap[newPos.y][newPos.x];