From 577d7e41c9ca2c498dc85e41c373fbdca8d2ed41 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 15 Jun 2012 11:44:54 +0300 Subject: SCI: Change Script::getObject() to accept a reg_t This is needed for upcoming changes to the Script class --- engines/sci/engine/kernel.cpp | 2 +- engines/sci/engine/script.cpp | 14 +++++++------- engines/sci/engine/script.h | 4 ++-- 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 Script::listAllDeallocatable(SegmentId segId) const { Common::Array Script::listAllOutgoingReferences(reg_t addr) const { Common::Array 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); } } } -- cgit v1.2.3