Skip to content

Commit

Permalink
SCI: Always use SegManager::getObjectName to get object names
Browse files Browse the repository at this point in the history
This ensures that all object name reading code works the same and
is in one place in the codebase.
  • Loading branch information
csnover committed May 21, 2017
1 parent 881be25 commit bc9835b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions engines/sci/console.cpp
Expand Up @@ -4211,14 +4211,14 @@ bool Console::cmdMapVocab994(int argc, const char **argv) {
if (obj && ofs < obj->getVarCount()) {
uint16 varSelector = obj->getVarSelector(ofs);
debugPrintf("%d: property at index %04x of %s is %s %s\n", i, ofs,
s->_segMan->derefString(obj->getNameSelector()),
s->_segMan->getObjectName(reg),
_engine->getKernel()->getSelectorName(varSelector).c_str(),
markers[varSelector] ? "(repeat!)" : "");
markers[varSelector] = true;
}
else {
debugPrintf("%d: property at index %04x doesn't match up with %s\n", i, ofs,
s->_segMan->derefString(obj->getNameSelector()));
s->_segMan->getObjectName(reg));
}
}

Expand Down
12 changes: 4 additions & 8 deletions engines/sci/engine/guest_additions.cpp
Expand Up @@ -359,14 +359,10 @@ static const byte SRDialogPatch[] = {
};

void GuestAdditions::patchGameSaveRestoreSCI32(Script &script) const {
ObjMap &objMap = script.getObjectMap();
for (ObjMap::iterator it = objMap.begin(); it != objMap.end(); ++it) {
Object &obj = it->_value;
if (obj.getNameSelector().isNull()) {
continue;
}

if (Common::String(_segMan->derefString(obj.getNameSelector())) != "SRDialog") {
const ObjMap &objMap = script.getObjectMap();
for (ObjMap::const_iterator it = objMap.begin(); it != objMap.end(); ++it) {
const Object &obj = it->_value;
if (strncmp(_segMan->getObjectName(obj.getPos()), "SRDialog", 8) != 0) {
continue;
}

Expand Down

0 comments on commit bc9835b

Please sign in to comment.