aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-05-20 20:32:27 -0500
committerColin Snover2017-05-20 21:14:18 -0500
commiteda836f21a3331e5a3a1e3c3965081f64a6e64eb (patch)
treebdef14d5ef39a35415fce32ac057e2ec0dda1426
parent71630a7cb242d208518bb9ff19e414211edae74c (diff)
downloadscummvm-rg350-eda836f21a3331e5a3a1e3c3965081f64a6e64eb.tar.gz
scummvm-rg350-eda836f21a3331e5a3a1e3c3965081f64a6e64eb.tar.bz2
scummvm-rg350-eda836f21a3331e5a3a1e3c3965081f64a6e64eb.zip
SCI: Nitpicky cleanup of some magic numbers and what-not-why comments
-rw-r--r--engines/sci/engine/object.cpp10
-rw-r--r--engines/sci/engine/savegame.cpp4
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<const byte> &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<const byte> &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<const byte> &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);
}