[Scummvm-cvs-logs] SF.net SVN: scummvm:[50438] scummvm/trunk/engines/sci/engine

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Jun 28 14:27:49 CEST 2010


Revision: 50438
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50438&view=rev
Author:   fingolfin
Date:     2010-06-28 12:27:48 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
SCI: get rid of Script::allocateObject

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/script.h

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-06-28 12:20:15 UTC (rev 50437)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-06-28 12:27:48 UTC (rev 50438)
@@ -181,10 +181,6 @@
 	}
 }
 
-Object *Script::allocateObject(uint16 offset) {
-	return &_objects[offset];
-}
-
 Object *Script::getObject(uint16 offset) {
 	if (_objects.contains(offset))
 		return &_objects[offset];
@@ -200,17 +196,16 @@
 }
 
 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 @@
 		// 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());
 		}
 

Modified: scummvm/trunk/engines/sci/engine/script.h
===================================================================
--- scummvm/trunk/engines/sci/engine/script.h	2010-06-28 12:20:15 UTC (rev 50437)
+++ scummvm/trunk/engines/sci/engine/script.h	2010-06-28 12:27:48 UTC (rev 50438)
@@ -111,7 +111,6 @@
 
 	virtual void saveLoadWithSerializer(Common::Serializer &ser);
 
-	Object *allocateObject(uint16 offset);
 	Object *getObject(uint16 offset);
 	const Object *getObject(uint16 offset) const;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list