diff options
author | Filippos Karapetis | 2012-06-15 11:44:54 +0300 |
---|---|---|
committer | Filippos Karapetis | 2012-06-15 12:24:14 +0300 |
commit | 577d7e41c9ca2c498dc85e41c373fbdca8d2ed41 (patch) | |
tree | a948e95374745b9a73a19a565a80cac03b42a4c0 | |
parent | 425926ed7ebde1fa77f3874498a6f285af75ac08 (diff) | |
download | scummvm-rg350-577d7e41c9ca2c498dc85e41c373fbdca8d2ed41.tar.gz scummvm-rg350-577d7e41c9ca2c498dc85e41c373fbdca8d2ed41.tar.bz2 scummvm-rg350-577d7e41c9ca2c498dc85e41c373fbdca8d2ed41.zip |
SCI: Change Script::getObject() to accept a reg_t
This is needed for upcoming changes to the Script class
-rw-r--r-- | engines/sci/engine/kernel.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/script.cpp | 14 | ||||
-rw-r--r-- | engines/sci/engine/script.h | 4 | ||||
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index c99bc4fe47..0266414b26 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -377,7 +377,7 @@ uint16 Kernel::findRegType(reg_t reg) { if (reg.offset <= (*(Script *)mobj).getBufSize() && reg.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT((*(Script *)mobj).getBuf(reg.offset)) ) { - result |= ((Script *)mobj)->getObject(reg.offset) ? SIG_TYPE_OBJECT : SIG_TYPE_REFERENCE; + result |= ((Script *)mobj)->getObject(reg) ? SIG_TYPE_OBJECT : SIG_TYPE_REFERENCE; } else result |= SIG_TYPE_REFERENCE; break; diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 5f0118b5b6..08f7922b1e 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -243,16 +243,16 @@ const byte *Script::getSci3ObjectsPointer() { return ptr; } -Object *Script::getObject(uint16 offset) { - if (_objects.contains(offset)) - return &_objects[offset]; +Object *Script::getObject(reg_t pos) { + if (_objects.contains(pos.offset)) + return &_objects[pos.offset]; else return 0; } -const Object *Script::getObject(uint16 offset) const { - if (_objects.contains(offset)) - return &_objects[offset]; +const Object *Script::getObject(reg_t pos) const { + if (_objects.contains(pos.offset)) + return &_objects[pos.offset]; else return 0; } @@ -746,7 +746,7 @@ Common::Array<reg_t> Script::listAllDeallocatable(SegmentId segId) const { Common::Array<reg_t> Script::listAllOutgoingReferences(reg_t addr) const { Common::Array<reg_t> tmp; if (addr.offset <= _bufSize && addr.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT(_buf + addr.offset)) { - const Object *obj = getObject(addr.offset); + const Object *obj = getObject(addr); if (obj) { // Note all local variables, if we have a local variable environment if (_localsSegment) diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index a180579d2f..06a7f089ba 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -119,8 +119,8 @@ public: virtual void saveLoadWithSerializer(Common::Serializer &ser); - Object *getObject(uint16 offset); - const Object *getObject(uint16 offset) const; + Object *getObject(reg_t pos); + const Object *getObject(reg_t pos) const; /** * Initializes an object within the segment manager diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index cc127c8dbc..cfa83a7697 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -228,7 +228,7 @@ Object *SegManager::getObject(reg_t pos) const { Script *scr = (Script *)mobj; if (pos.offset <= scr->getBufSize() && pos.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT(scr->getBuf(pos.offset))) { - obj = scr->getObject(pos.offset); + obj = scr->getObject(pos); } } } |