From bc9835ba5ee32679a715f4f5f734786b7120191f Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 20 May 2017 20:16:32 -0500 Subject: SCI: Always use SegManager::getObjectName to get object names This ensures that all object name reading code works the same and is in one place in the codebase. --- engines/sci/console.cpp | 4 ++-- engines/sci/engine/guest_additions.cpp | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 0e90f22eba..99c5498443 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -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)); } } diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp index e2b7354bdf..23f600fe5f 100644 --- a/engines/sci/engine/guest_additions.cpp +++ b/engines/sci/engine/guest_additions.cpp @@ -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; } -- cgit v1.2.3