aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-04-09 11:07:38 +0000
committerNicola Mettifogo2007-04-09 11:07:38 +0000
commitcfcf281b86ea412ae9c85475bc4ae20ccf47f651 (patch)
treedb679fe3893560d063e90fb4b9fd0619aa25727c /engines
parent41a5f70d72dd6a708b436c78e2fc58c88b9131ac (diff)
downloadscummvm-rg350-cfcf281b86ea412ae9c85475bc4ae20ccf47f651.tar.gz
scummvm-rg350-cfcf281b86ea412ae9c85475bc4ae20ccf47f651.tar.bz2
scummvm-rg350-cfcf281b86ea412ae9c85475bc4ae20ccf47f651.zip
Cleanup of Zone/Animation removal code. Only the good god of void pointers knows how it managed to work until now.
svn-id: r26430
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables.cpp4
-rw-r--r--engines/parallaction/location.cpp13
-rw-r--r--engines/parallaction/parallaction.cpp13
-rw-r--r--engines/parallaction/parallaction.h2
-rw-r--r--engines/parallaction/saveload.cpp10
5 files changed, 9 insertions, 33 deletions
diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp
index 5d0b8979c3..570e1c0ea3 100644
--- a/engines/parallaction/callables.cpp
+++ b/engines/parallaction/callables.cpp
@@ -413,12 +413,10 @@ void _c_finito(void *parm) {
// 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
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index 3c3aaab540..a59c2bbd26 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -195,22 +195,13 @@ void Parallaction::freeLocation() {
// 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) {
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 9aa5e1e3fe..fc0399f853 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -805,19 +805,6 @@ void Parallaction::changeCharacter(const char *name) {
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) {
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 796bbbc65c..5ac53c932f 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -199,7 +199,7 @@ void waitUntilLeftClick();
void addNode(Node *list, Node *n);
void removeNode(Node *n);
-void freeNodeList(Node *list);
+
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 5ad54adeea..284ac9402c 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -81,14 +81,14 @@ void Parallaction::doLoadGame(uint16 slot) {
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);