From c80429008f135c236544846920f488680fa7c200 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 3 Jul 2012 03:33:42 +0300 Subject: 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 --- engines/sci/engine/seg_manager.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'engines') 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()); - } } } -- cgit v1.2.3