aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-10-21 15:41:21 +0000
committerNicola Mettifogo2007-10-21 15:41:21 +0000
commitaa01449f297dd4c49bd5b852bf27142f28b826ac (patch)
treef0d5bc0edc60ea808aba5e933b9168e8c1763959 /engines/parallaction
parent03d5111a74c7ab92c07b469ca6945544265fea12 (diff)
downloadscummvm-rg350-aa01449f297dd4c49bd5b852bf27142f28b826ac.tar.gz
scummvm-rg350-aa01449f297dd4c49bd5b852bf27142f28b826ac.tar.bz2
scummvm-rg350-aa01449f297dd4c49bd5b852bf27142f28b826ac.zip
Relaxed freeZones policy for deciding which zones to preserve across location switches. Special zones are now never deleted even if strictly not needed. This will fix some occasional crashes related to inventory management.
svn-id: r29241
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/parallaction.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 52c5dd924b..abf67efb1c 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -985,26 +985,15 @@ void Parallaction::freeZones() {
while ( it != _zones.end() ) {
+ // NOTE : this condition has been relaxed compared to the original, to allow the engine
+ // to retain special - needed - zones that were lost across location switches.
Zone* z = *it;
-
- // WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
- // instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
- // but we need to check it separately here. The same workaround is applied in hitZone.
- if (((z->_top == -1) ||
- ((z->_left == -2) && (
- (((z->_type & 0xFFFF) == kZoneMerge) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj1)) != 0) || (isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj2)) != 0))) ||
- (((z->_type & 0xFFFF) == kZoneGet) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.get->_icon)) != 0)))
- ))) &&
- ((_engineFlags & kEngineQuit) == 0)) {
-
+ if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) {
debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_label._text);
-
it++;
-
- } else
-
+ } else {
it = _zones.erase(it);
-
+ }
}
return;