From 71630a7cb242d208518bb9ff19e414211edae74c Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 20 May 2017 20:25:28 -0500 Subject: SCI: Remove duplicate relocateBlock function --- engines/sci/engine/object.cpp | 23 +---------------------- engines/sci/engine/script.cpp | 4 +--- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index a09d530812..079106ff12 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -30,29 +30,8 @@ namespace Sci { -// This helper function is used by Script::relocateLocal and Object::relocate -// Duplicate in segment.cpp and script.cpp -static bool relocateBlock(Common::Array &block, int block_location, SegmentId segment, int location, size_t scriptSize) { - int rel = location - block_location; +extern bool relocateBlock(Common::Array &block, int block_location, SegmentId segment, int location, uint32 heapOffset); - if (rel < 0) - return false; - - uint idx = rel >> 1; - - if (idx >= block.size()) - return false; - - if (rel & 1) { - error("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location); - return false; - } - block[idx].setSegment(segment); // Perform relocation - if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1_LATE) - block[idx].incOffset(scriptSize); - - return true; -} void Object::init(const SciSpan &buf, reg_t obj_pos, bool initVariables) { const SciSpan data = buf.subspan(obj_pos.getOffset()); diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 7e3a661501..2f04534343 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -661,9 +661,7 @@ Object *Script::scriptObjInit(reg_t obj_pos, bool fullObjectInit) { return obj; } -// This helper function is used by Script::relocateLocal and Object::relocate -// Duplicate in segment.cpp and script.cpp -static bool relocateBlock(Common::Array &block, int block_location, SegmentId segment, int location, size_t scriptSize) { +bool relocateBlock(Common::Array &block, int block_location, SegmentId segment, int location, uint32 heapOffset) { int rel = location - block_location; if (rel < 0) -- cgit v1.2.3