From eda836f21a3331e5a3a1e3c3965081f64a6e64eb Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 20 May 2017 20:32:27 -0500 Subject: SCI: Nitpicky cleanup of some magic numbers and what-not-why comments --- engines/sci/engine/object.cpp | 10 +++++----- engines/sci/engine/savegame.cpp | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index 079106ff12..0ab8449323 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -54,8 +54,8 @@ void Object::init(const SciSpan &buf, reg_t obj_pos, bool initVariab } _methodCount = data.getUint16LEAt(header.getUint16LEAt(kOffsetHeaderFunctionArea) - 2); - for (int i = 0; i < _methodCount * 2 + 2; ++i) { - _baseMethod.push_back(data.getUint16SEAt(header.getUint16LEAt(kOffsetHeaderFunctionArea) + i * 2)); + for (uint i = 0; i < _methodCount * sizeof(uint16) + 2; ++i) { + _baseMethod.push_back(data.getUint16SEAt(header.getUint16LEAt(kOffsetHeaderFunctionArea) + i * sizeof(uint16))); } } else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1_LATE) { _variables.resize(data.getUint16SEAt(2)); @@ -72,8 +72,8 @@ void Object::init(const SciSpan &buf, reg_t obj_pos, bool initVariab } _methodCount = buf.getUint16SEAt(data.getUint16SEAt(6)); - for (int i = 0; i < _methodCount * 2 + 3; ++i) { - _baseMethod.push_back(buf.getUint16SEAt(data.getUint16SEAt(6) + i * 2)); + for (uint i = 0; i < _methodCount * sizeof(uint16) + 3; ++i) { + _baseMethod.push_back(buf.getUint16SEAt(data.getUint16SEAt(6) + i * sizeof(uint16))); } #ifdef ENABLE_SCI32 } else if (getSciVersion() == SCI_VERSION_3) { @@ -90,7 +90,7 @@ void Object::init(const SciSpan &buf, reg_t obj_pos, bool initVariab { #endif for (uint i = 0; i < _variables.size(); i++) - _variables[i] = make_reg(0, data.getUint16SEAt(i * 2)); + _variables[i] = make_reg(0, data.getUint16SEAt(i * sizeof(uint16))); } } } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 1095b7fe53..8767744acc 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -233,7 +233,6 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) { } #ifdef ENABLE_SCI32 } else if (type == SEG_TYPE_ARRAY) { - // Set the correct segment for SCI32 arrays _arraysSegId = i; } else if (s.getVersion() >= 36 && type == SEG_TYPE_BITMAP) { _bitmapSegId = i; @@ -251,13 +250,10 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) { if (type == SEG_TYPE_SCRIPT) { Script *scr = (Script *)mobj; - // If we are loading a script, perform some extra steps if (s.isLoading()) { - // Hook the script up in the script->segment map _scriptSegMap[scr->getScriptNumber()] = i; } - // Sync the script's string heap if (s.getVersion() >= 28) scr->syncStringHeap(s); } -- cgit v1.2.3