diff options
author | Strangerke | 2015-11-24 17:44:21 +0100 |
---|---|---|
committer | Strangerke | 2015-11-24 17:44:21 +0100 |
commit | 351ce463ca1de2d4241162d88653022d65fd004d (patch) | |
tree | 8cf4714584340c4faf0492903b8483bc7b463130 /engines/mads/phantom | |
parent | 9b52ce590f011fc5d3606f38eb7a8f07c39d4b59 (diff) | |
download | scummvm-rg350-351ce463ca1de2d4241162d88653022d65fd004d.tar.gz scummvm-rg350-351ce463ca1de2d4241162d88653022d65fd004d.tar.bz2 scummvm-rg350-351ce463ca1de2d4241162d88653022d65fd004d.zip |
MADS: Phantom: Add more checks in exitCatacombs
Fix an assert in moveCatacombs
Diffstat (limited to 'engines/mads/phantom')
-rw-r--r-- | engines/mads/phantom/game_phantom.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp index b806c1e52a..dd649d1e4a 100644 --- a/engines/mads/phantom/game_phantom.cpp +++ b/engines/mads/phantom/game_phantom.cpp @@ -885,13 +885,14 @@ void GamePhantom::setupCatacombs() { } int GamePhantom::exitCatacombs(int dir) { - int scene = _globals[kCatacombsRoom]; - assert ((scene < _catacombSize) && (dir < 4)); - return (_catacombs[scene]._exit[dir]); + assert(_globals[kCatacombsRoom] == CLIP(_globals[kCatacombsRoom], 0, _catacombSize - 1)); + assert(dir == CLIP(dir, 0, 3)); + + return (_catacombs[_globals[kCatacombsRoom]]._exit[dir]); } void GamePhantom::moveCatacombs(int dir) { - assert(_globals[kCatacombsRoom] == CLIP(_globals[kCatacombsRoom], 0, _catacombSize)); + assert(_globals[kCatacombsRoom] == CLIP(_globals[kCatacombsRoom], 0, _catacombSize - 1)); assert(dir == CLIP(dir, 0, 3)); newCatacombRoom(_catacombs[_globals[kCatacombsRoom]]._fromDirection[dir], _catacombs[_globals[kCatacombsRoom]]._exit[dir]); |