diff options
author | Paul Gilbert | 2018-04-03 22:58:17 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-04-03 22:58:17 -0400 |
commit | 73d72f4fc84d3c047415f0de2d2f2f0fb5cb7879 (patch) | |
tree | 70d416638bc06b760cc43100e867b87d6e9d5833 | |
parent | 4fefa8828283d7f6857327b3e19ccaf8cbee33a5 (diff) | |
download | scummvm-rg350-73d72f4fc84d3c047415f0de2d2f2f0fb5cb7879.tar.gz scummvm-rg350-73d72f4fc84d3c047415f0de2d2f2f0fb5cb7879.tar.bz2 scummvm-rg350-73d72f4fc84d3c047415f0de2d2f2f0fb5cb7879.zip |
XEEN: Fix cmdIfMapFlag crash when banging Winterkill gong
-rw-r--r-- | engines/xeen/scripts.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 6230d1cc8d..cd95a5938f 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -1207,14 +1207,25 @@ bool Scripts::cmdDisplayBottom(ParamsIterator ¶ms) { bool Scripts::cmdIfMapFlag(ParamsIterator ¶ms) { Map &map = *_vm->_map; - MazeMonster &monster = map._mobData._monsters[params.readByte()]; + int monsterNum = params.readByte(); + int lineNum = params.readByte(); - if (monster._position.x >= 32 || monster._position.y >= 32) { - _lineNum = params.readByte(); - return false; + if (monsterNum == 0xff) { + for (monsterNum = 0; monsterNum < (int)map._mobData._monsters.size(); ++monsterNum) { + MazeMonster &monster = map._mobData._monsters[monsterNum]; + + if ((uint)monster._position.x < 32 && (uint)monster._position.y < 32) + return true; + } + } else { + MazeMonster &monster = map._mobData._monsters[monsterNum]; + + if ((uint)monster._position.x < 32 && (uint)monster._position.y > 32) + return true; } - return true; + _lineNum = lineNum; + return false; } bool Scripts::cmdSelectRandomChar(ParamsIterator ¶ms) { |