aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2012-07-03 03:33:42 +0300
committerFilippos Karapetis2012-07-03 03:34:30 +0300
commitc80429008f135c236544846920f488680fa7c200 (patch)
tree8c91142e5039255edbd4e1d7113964a4ce30a714
parentb091c0bd090f075e6e0b796785c400dbe9d2b8ac (diff)
downloadscummvm-rg350-c80429008f135c236544846920f488680fa7c200.tar.gz
scummvm-rg350-c80429008f135c236544846920f488680fa7c200.tar.bz2
scummvm-rg350-c80429008f135c236544846920f488680fa7c200.zip
SCI: Remove an unnecessary warning and related FIXME comments
It's perfectly normal behavior to have locals with a smaller segment ID than the ID of their respective script, e.g. when scripts are uninstantiated and then instantiated again
-rw-r--r--engines/sci/engine/seg_manager.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index d425e170ce..951fc7c363 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -154,22 +154,15 @@ void SegManager::deallocate(SegmentId seg) {
Script *scr = (Script *)mobj;
_scriptSegMap.erase(scr->getScriptNumber());
if (scr->getLocalsSegment()) {
- // HACK: Check if the locals segment has already been deallocated.
- // This happens sometimes in SQ4CD when resetting the segment
- // manager: the locals for script 808 are somehow stored in a
- // smaller segment than the script itself, so by the time the script
- // is about to be freed, the locals block has already been freed.
- // This isn't fatal, but it shouldn't be happening at all.
- // FIXME: Check why this happens. Perhaps there's a bug in the
- // script handling code?
- if (!_heap[scr->getLocalsSegment()]) {
- warning("SegManager::deallocate(): The locals block of script "
- "%d has already been deallocated. Script segment: %d, "
- "locals segment: %d", scr->getScriptNumber(), seg,
- scr->getLocalsSegment());
- } else {
+ // Check if the locals segment has already been deallocated.
+ // If the locals block has been stored in a segment with an ID
+ // smaller than the segment ID of the script itself, it will be
+ // already freed at this point. This can happen when scripts are
+ // uninstantiated and instantiated again: they retain their own
+ // segment ID, but are allocated a new locals segment, which can
+ // have an ID smaller than the segment of the script itself.
+ if (_heap[scr->getLocalsSegment()])
deallocate(scr->getLocalsSegment());
- }
}
}