aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorStrangerke2013-08-21 22:31:39 +0200
committerStrangerke2013-08-21 22:31:39 +0200
commit6cfd3028c1fdf71238f12e79fba4750e63a92a67 (patch)
tree7edd33be12b605698d06f163708e35cfc0230b81 /engines/mortevielle
parent9c3cefa6f0ec801a99c697e796b985e14012379e (diff)
downloadscummvm-rg350-6cfd3028c1fdf71238f12e79fba4750e63a92a67.tar.gz
scummvm-rg350-6cfd3028c1fdf71238f12e79fba4750e63a92a67.tar.bz2
scummvm-rg350-6cfd3028c1fdf71238f12e79fba4750e63a92a67.zip
MORTEVIELLE: Fix CID 1063213
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/actions.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index b76b7e887e..4de2ebc804 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -626,9 +626,20 @@ void MortevielleEngine::fctOpen() {
_coreVar._faithScore += 2;
++_openObjCount;
int i;
- for (i = 1; (i <= 6) && (_openObjects[i] != 0) && (_openObjects[i] != _num); i++)
- ;
- if (_openObjects[i] != _num) {
+ for (i = 1; (i <= 6); i++) {
+ if ((_openObjects[i] == 0) || (_openObjects[i] == _num))
+ break;
+ }
+
+ if (i > 7) {
+ warning("Unexpected action: Too many open objects");
+ return;
+ }
+
+ if (_openObjects[i] == _num)
+ // display "Already Opened"
+ _crep = 18;
+ else {
if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM)
|| (_coreVar._currPlace == JULIA_ROOM)
|| (_coreVar._currPlace == BLUE_ROOM)
@@ -661,9 +672,7 @@ void MortevielleEngine::fctOpen() {
_crep = _tabdon[kAouvr + (tmpPlace * 7) + _num - 1];
if (_crep == 254)
_crep = 999;
- } else
- // display "Already Opened"
- _crep = 18;
+ }
}
}