[Scummvm-cvs-logs] SF.net SVN: scummvm:[44959] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Mon Oct 12 01:54:45 CEST 2009


Revision: 44959
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44959&view=rev
Author:   spalek
Date:     2009-10-11 23:54:44 +0000 (Sun, 11 Oct 2009)

Log Message:
-----------
Reduced code duplication and fixed one deletion bug.

Modified Paths:
--------------
    scummvm/trunk/engines/draci/game.h
    scummvm/trunk/engines/draci/script.cpp

Modified: scummvm/trunk/engines/draci/game.h
===================================================================
--- scummvm/trunk/engines/draci/game.h	2009-10-11 23:28:40 UTC (rev 44958)
+++ scummvm/trunk/engines/draci/game.h	2009-10-11 23:54:44 UTC (rev 44959)
@@ -214,7 +214,7 @@
   * Enumerates the animations for the dragon's movement.
   */
 enum Movement {
-	kMoveUndefined,
+	kMoveUndefined = -1,
 	kMoveDown, kMoveUp, kMoveRight, kMoveLeft,
 	kMoveRightDown, kMoveRightUp, kMoveLeftDown, kMoveLeftUp,
 	kMoveDownRight, kMoveUpRight, kMoveDownLeft, kMoveUpLeft,
@@ -270,6 +270,7 @@
 	GameObject *getObject(uint objNum);
 	int getObjectWithAnimation(int animID) const;
 	void deleteObjectAnimations();
+	void deleteAnimationsAfterIndex(int lastAnimIndex);
 
 	int getVariable(int varNum) const;
 	void setVariable(int varNum, int value);
@@ -346,7 +347,6 @@
 	void DoSync(Common::Serializer &s);
 
 private:
-	void deleteAnimationsAfterIndex(int lastAnimIndex);
 	void enterNewRoom(bool force_reload);
 	void loadRoom(int roomNum);
 	void runGateProgram(int gate);

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2009-10-11 23:28:40 UTC (rev 44958)
+++ scummvm/trunk/engines/draci/script.cpp	2009-10-11 23:54:44 UTC (rev 44959)
@@ -526,21 +526,7 @@
 void Script::release(Common::Queue<int> &params) {
 	int markedIndex = _vm->_game->getMarkedAnimationIndex();
 
-	// Also delete those animations from the game's objects
-	for (uint i = 0; i < _vm->_game->getNumObjects(); ++i) {
-		GameObject *obj = _vm->_game->getObject(i);
-
-		for (uint j = 0; j < obj->_anims.size(); ++j) {
-			Animation *anim;
-
-			anim = _vm->_anims->getAnimation(obj->_anims[j]);
-			if (anim != NULL && anim->getIndex() > markedIndex)
-				obj->_anims.remove_at(j);
-		}
-	}
-
-	// Delete animations which have an index greater than the marked index
-	_vm->_anims->deleteAfterIndex(markedIndex);
+	_vm->_game->deleteAnimationsAfterIndex(markedIndex);
 }
 
 void Script::icoStat(Common::Queue<int> &params) {


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