diff options
author | Filippos Karapetis | 2011-11-05 10:07:03 +0200 |
---|---|---|
committer | Filippos Karapetis | 2011-11-05 10:07:03 +0200 |
commit | 58190c36b4cc84b3200239211d91b0291301db56 (patch) | |
tree | fb21e29ce777cc9750809e0195a698bb31355b53 /engines/sci/engine | |
parent | 267c6f1756c9582b8bd9534334c7f264a2400929 (diff) | |
download | scummvm-rg350-58190c36b4cc84b3200239211d91b0291301db56.tar.gz scummvm-rg350-58190c36b4cc84b3200239211d91b0291301db56.tar.bz2 scummvm-rg350-58190c36b4cc84b3200239211d91b0291301db56.zip |
SCI: Made the object map hashmap of the Script class private
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/script.h | 10 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 3 |
3 files changed, 10 insertions, 11 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 2f87137d7f..f1c7133d01 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 b6610aadea..8c5495d852 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 4e822a5a1e..09d586a1c6 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); |