[Scummvm-cvs-logs] scummvm master -> 58190c36b4cc84b3200239211d91b0291301db56
bluegr
md5 at scummvm.org
Sat Nov 5 09:07:45 CET 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
58190c36b4 SCI: Made the object map hashmap of the Script class private
Commit: 58190c36b4cc84b3200239211d91b0291301db56
https://github.com/scummvm/scummvm/commit/58190c36b4cc84b3200239211d91b0291301db56
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-11-05T01:07:03-07:00
Commit Message:
SCI: Made the object map hashmap of the Script class private
Changed paths:
engines/sci/console.cpp
engines/sci/engine/savegame.cpp
engines/sci/engine/script.h
engines/sci/engine/seg_manager.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 664fa67..b852de7 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1881,11 +1881,12 @@ bool Console::segmentInfo(int nr) {
else
DebugPrintf(" Locals : none\n");
- DebugPrintf(" Objects: %4d\n", scr->_objects.size());
+ ObjMap objects = scr->getObjectMap();
+ DebugPrintf(" Objects: %4d\n", objects.size());
ObjMap::iterator it;
- const ObjMap::iterator end = scr->_objects.end();
- for (it = scr->_objects.begin(); it != end; ++it) {
+ const ObjMap::iterator end = objects.end();
+ for (it = objects.begin(); it != end; ++it) {
DebugPrintf(" ");
// Object header
const Object *obj = _engine->_gamestate->_segMan->getObject(it->_value.getPos());
@@ -2942,9 +2943,10 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
script = customSegMan->getScript(scriptSegment);
// Iterate through all the script's objects
+ ObjMap objects = script->getObjectMap();
ObjMap::iterator it;
- const ObjMap::iterator end = script->_objects.end();
- for (it = script->_objects.begin(); it != end; ++it) {
+ const ObjMap::iterator end = objects.end();
+ for (it = objects.begin(); it != end; ++it) {
const Object *obj = customSegMan->getObject(it->_value.getPos());
const char *objName = customSegMan->getObjectName(it->_value.getPos());
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 2f87137..f1c7133 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -203,7 +203,8 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
// Now, load the script itself
scr->load(g_sci->getResMan());
- for (ObjMap::iterator it = scr->_objects.begin(); it != scr->_objects.end(); ++it)
+ ObjMap objects = scr->getObjectMap();
+ for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it)
it->_value.syncBaseObject(scr->getBuf(it->_value.getPos().offset));
}
@@ -228,7 +229,8 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
Script *scr = (Script *)_heap[i];
scr->syncLocalsBlock(this);
- for (ObjMap::iterator it = scr->_objects.begin(); it != scr->_objects.end(); ++it) {
+ ObjMap objects = scr->getObjectMap();
+ for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it) {
reg_t addr = it->_value.getPos();
Object *obj = scr->scriptObjInit(addr, false);
@@ -237,7 +239,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
// TODO/FIXME: This should not be happening at all. It might indicate a possible issue
// with the garbage collector. It happens for example in LSL5 (German, perhaps English too).
warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
- scr->_objects.erase(addr.toUint16());
+ objects.erase(addr.toUint16());
}
}
}
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index b6610aa..8c5495d 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -62,7 +62,7 @@ private:
const uint16 *_exportTable; /**< Abs. offset of the export table or 0 if not present */
uint16 _numExports; /**< Number of entries in the exports table */
- const byte *_synonyms; /**< Synonyms block or 0 if not present*/
+ const byte *_synonyms; /**< Synonyms block or 0 if not present */
uint16 _numSynonyms; /**< Number of entries in the synonyms block */
int _localsOffset;
@@ -72,12 +72,7 @@ private:
SegmentId _localsSegment; /**< The local variable segment */
LocalVariables *_localsBlock;
-public:
- /**
- * Table for objects, contains property variables.
- * Indexed by the TODO offset.
- */
- ObjMap _objects;
+ ObjMap _objects; /**< Table for objects, contains property variables */
public:
int getLocalsOffset() const { return _localsOffset; }
@@ -92,6 +87,7 @@ public:
SegmentId getLocalsSegment() const { return _localsSegment; }
reg_t *getLocalsBegin() { return _localsBlock ? _localsBlock->_locals.begin() : NULL; }
void syncLocalsBlock(SegManager *segMan);
+ ObjMap getObjectMap() const { return _objects; }
public:
Script();
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 4e822a5..09d586a 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -270,7 +270,8 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
if (mobj->getType() == SEG_TYPE_SCRIPT) {
// It's a script, scan all objects in it
const Script *scr = (const Script *)mobj;
- for (ObjMap::const_iterator it = scr->_objects.begin(); it != scr->_objects.end(); ++it) {
+ ObjMap objects = scr->getObjectMap();
+ for (ObjMap::const_iterator it = objects.begin(); it != objects.end(); ++it) {
objpos.offset = it->_value.getPos().offset;
if (name == getObjectName(objpos))
result.push_back(objpos);
More information about the Scummvm-git-logs
mailing list