diff options
author | Max Horn | 2010-06-28 12:27:48 +0000 |
---|---|---|
committer | Max Horn | 2010-06-28 12:27:48 +0000 |
commit | a278c07aa61fb6790b0f0eb57c8b8b0df4ab1b90 (patch) | |
tree | 3d55e3692bc810cb31514d00477365cd97438343 /engines/sci/engine/script.cpp | |
parent | 0d6efb2334aeed7f63ab68538d74021d0491f423 (diff) | |
download | scummvm-rg350-a278c07aa61fb6790b0f0eb57c8b8b0df4ab1b90.tar.gz scummvm-rg350-a278c07aa61fb6790b0f0eb57c8b8b0df4ab1b90.tar.bz2 scummvm-rg350-a278c07aa61fb6790b0f0eb57c8b8b0df4ab1b90.zip |
SCI: get rid of Script::allocateObject
svn-id: r50438
Diffstat (limited to 'engines/sci/engine/script.cpp')
-rw-r--r-- | engines/sci/engine/script.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index ac6fb6f26d..2c2325a730 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -181,10 +181,6 @@ void Script::load(ResourceManager *resMan) { } } -Object *Script::allocateObject(uint16 offset) { - return &_objects[offset]; -} - Object *Script::getObject(uint16 offset) { if (_objects.contains(offset)) return &_objects[offset]; @@ -200,17 +196,16 @@ const Object *Script::getObject(uint16 offset) const { } Object *Script::scriptObjInit(reg_t obj_pos, bool fullObjectInit) { - Object *obj; - if (getSciVersion() < SCI_VERSION_1_1 && fullObjectInit) obj_pos.offset += 8; // magic offset (SCRIPT_OBJECT_MAGIC_OFFSET) VERIFY(obj_pos.offset < _bufSize, "Attempt to initialize object beyond end of script\n"); - obj = allocateObject(obj_pos.offset); - VERIFY(obj_pos.offset + kOffsetFunctionArea < (int)_bufSize, "Function area pointer stored beyond end of script\n"); + // Get the object at the specified position and init it. This will + // automatically "allocate" space for it in the _objects map if necessary. + Object *obj = &_objects[obj_pos.offset]; obj->init(_buf, obj_pos, fullObjectInit); return obj; @@ -508,7 +503,7 @@ void Script::initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId) { // talk-clicks on the robot will act like clicking on ego if (!obj->isClass()) { reg_t classObject = obj->getSuperClassSelector(); - Object *classObj = segMan->getObject(classObject); + const Object *classObj = segMan->getObject(classObject); obj->setPropDictSelector(classObj->getPropDictSelector()); } |