[Scummvm-cvs-logs] SF.net SVN: scummvm: [26430] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Apr 9 13:07:38 CEST 2007


Revision: 26430
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26430&view=rev
Author:   peres001
Date:     2007-04-09 04:07:38 -0700 (Mon, 09 Apr 2007)

Log Message:
-----------
Cleanup of Zone/Animation removal code. Only the good god of void pointers knows how it managed to work until now.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables.cpp
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/saveload.cpp

Modified: scummvm/trunk/engines/parallaction/callables.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables.cpp	2007-04-09 10:58:14 UTC (rev 26429)
+++ scummvm/trunk/engines/parallaction/callables.cpp	2007-04-09 11:07:38 UTC (rev 26430)
@@ -413,12 +413,10 @@
 
 	// TODO (LIST): this sequence should be just _zones.clear()
 	_vm->freeZones(_vm->_zones._next);
-	freeNodeList(_vm->_zones._next);
 	_vm->_zones._next = NULL;
 
 	// TODO (LIST): this sequence should be just _animations.clear()
-	_vm->freeZones(_vm->_animations._next);
-	freeNodeList(_vm->_animations._next);
+	_vm->freeAnimations();
 	_vm->_animations._next = NULL;
 
 	// this dangerous flag can now be cleared

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-04-09 10:58:14 UTC (rev 26429)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-04-09 11:07:38 UTC (rev 26430)
@@ -195,22 +195,13 @@
 	// but that'll pretty meaningless with a single list approach.
 	helperNode._prev = helperNode._next = NULL;
 	freeZones(_zones._next);
-	freeNodeList(_zones._next);
 	_zones._next = helperNode._next;
 	_zones._prev = helperNode._prev;
-//	memcpy(&_zones, &helperNode, sizeof(Node));
 	debugC(7, kDebugLocation, "freeLocation: zones freed");
 
-	// TODO (LIST): helperNode should be rendered useless by the use of a Common::List<>
-	// to store Zones and Animations. Right now, it holds a list of Zones to be preserved
-	// but that'll pretty meaningless with a single list approach.
-	helperNode._prev = helperNode._next = NULL;
-	freeZones(_animations._next);
 	freeAnimations();
-	freeNodeList(_animations._next);
-	_animations._next = helperNode._next;
-	_animations._prev = helperNode._prev;
-//	memcpy(&_animations, &helperNode, sizeof(Node));
+	_animations._next = 0;
+	_animations._prev = 0;
 	debugC(7, kDebugLocation, "freeLocation: animations freed");
 
 	if (_location._comment) {

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-04-09 10:58:14 UTC (rev 26429)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-04-09 11:07:38 UTC (rev 26430)
@@ -805,19 +805,6 @@
 	return;
 }
 
-// TODO (LIST): this rouinte basically performs List<>::clear()
-// so it will become useless
-void freeNodeList(Node *list) {
-
-	while (list) {
-		Node *v4 = list->_next;
-		free(list);
-		list = v4;
-	}
-
-	return;
-}
-
 // TODO (LIST): this routine will be removed
 void addNode(Node *list, Node *n) {
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-04-09 10:58:14 UTC (rev 26429)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-04-09 11:07:38 UTC (rev 26430)
@@ -199,10 +199,10 @@
 
 void addNode(Node *list, Node *n);
 void removeNode(Node *n);
-void freeNodeList(Node *list);
 
 
 
+
 void jobRemovePickedItem(void*, Job *j);
 void jobDisplayDroppedItem(void*, Job *j);
 void jobToggleDoor(void*, Job *j);

Modified: scummvm/trunk/engines/parallaction/saveload.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/saveload.cpp	2007-04-09 10:58:14 UTC (rev 26429)
+++ scummvm/trunk/engines/parallaction/saveload.cpp	2007-04-09 11:07:38 UTC (rev 26430)
@@ -81,14 +81,14 @@
 
 	f->readLine(s, 15);
 
-	// TODO (LIST): the very same code can be found in _c_finito().
-	// Why aren't we clearing Animations too, anyway?
+	// TODO (LIST): unify (and parametrize) calls to freeZones.
+	// We aren't calling freeAnimations because it is not needed, since
+	// kChangeLocation will trigger a complete deletion. Anyway, we still
+	// need to invoke freeZones here with kEngineQuit set, because the
+	// call in changeLocation preserve certain zones.
 	_engineFlags |= kEngineQuit;
-
 	freeZones(_zones._next);
-	freeNodeList(_zones._next);
 	_zones._next = NULL;
-
 	_engineFlags &= ~kEngineQuit;
 
 	_numLocations = atoi(s);


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