Skip to content

Commit

Permalink
SCI: Nitpicky cleanup of some magic numbers and what-not-why comments
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed May 21, 2017
1 parent 71630a7 commit eda836f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 5 additions & 5 deletions engines/sci/engine/object.cpp
Expand Up @@ -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));
Expand All @@ -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) {
Expand All @@ -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)));
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions engines/sci/engine/savegame.cpp
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit eda836f

Please sign in to comment.