Cleanup of Zone/Animation removal code. Only the good god of void pointers knows how it managed to work until now.
svn-id: r26430
This commit is contained in:
parent
41a5f70d72
commit
cfcf281b86
5 changed files with 9 additions and 33 deletions
|
@ -413,12 +413,10 @@ void _c_finito(void *parm) {
|
||||||
|
|
||||||
// TODO (LIST): this sequence should be just _zones.clear()
|
// TODO (LIST): this sequence should be just _zones.clear()
|
||||||
_vm->freeZones(_vm->_zones._next);
|
_vm->freeZones(_vm->_zones._next);
|
||||||
freeNodeList(_vm->_zones._next);
|
|
||||||
_vm->_zones._next = NULL;
|
_vm->_zones._next = NULL;
|
||||||
|
|
||||||
// TODO (LIST): this sequence should be just _animations.clear()
|
// TODO (LIST): this sequence should be just _animations.clear()
|
||||||
_vm->freeZones(_vm->_animations._next);
|
_vm->freeAnimations();
|
||||||
freeNodeList(_vm->_animations._next);
|
|
||||||
_vm->_animations._next = NULL;
|
_vm->_animations._next = NULL;
|
||||||
|
|
||||||
// this dangerous flag can now be cleared
|
// this dangerous flag can now be cleared
|
||||||
|
|
|
@ -195,22 +195,13 @@ void Parallaction::freeLocation() {
|
||||||
// but that'll pretty meaningless with a single list approach.
|
// but that'll pretty meaningless with a single list approach.
|
||||||
helperNode._prev = helperNode._next = NULL;
|
helperNode._prev = helperNode._next = NULL;
|
||||||
freeZones(_zones._next);
|
freeZones(_zones._next);
|
||||||
freeNodeList(_zones._next);
|
|
||||||
_zones._next = helperNode._next;
|
_zones._next = helperNode._next;
|
||||||
_zones._prev = helperNode._prev;
|
_zones._prev = helperNode._prev;
|
||||||
// memcpy(&_zones, &helperNode, sizeof(Node));
|
|
||||||
debugC(7, kDebugLocation, "freeLocation: zones freed");
|
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();
|
freeAnimations();
|
||||||
freeNodeList(_animations._next);
|
_animations._next = 0;
|
||||||
_animations._next = helperNode._next;
|
_animations._prev = 0;
|
||||||
_animations._prev = helperNode._prev;
|
|
||||||
// memcpy(&_animations, &helperNode, sizeof(Node));
|
|
||||||
debugC(7, kDebugLocation, "freeLocation: animations freed");
|
debugC(7, kDebugLocation, "freeLocation: animations freed");
|
||||||
|
|
||||||
if (_location._comment) {
|
if (_location._comment) {
|
||||||
|
|
|
@ -805,19 +805,6 @@ void Parallaction::changeCharacter(const char *name) {
|
||||||
return;
|
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
|
// TODO (LIST): this routine will be removed
|
||||||
void addNode(Node *list, Node *n) {
|
void addNode(Node *list, Node *n) {
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ void waitUntilLeftClick();
|
||||||
|
|
||||||
void addNode(Node *list, Node *n);
|
void addNode(Node *list, Node *n);
|
||||||
void removeNode(Node *n);
|
void removeNode(Node *n);
|
||||||
void freeNodeList(Node *list);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,14 +81,14 @@ void Parallaction::doLoadGame(uint16 slot) {
|
||||||
|
|
||||||
f->readLine(s, 15);
|
f->readLine(s, 15);
|
||||||
|
|
||||||
// TODO (LIST): the very same code can be found in _c_finito().
|
// TODO (LIST): unify (and parametrize) calls to freeZones.
|
||||||
// Why aren't we clearing Animations too, anyway?
|
// 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;
|
_engineFlags |= kEngineQuit;
|
||||||
|
|
||||||
freeZones(_zones._next);
|
freeZones(_zones._next);
|
||||||
freeNodeList(_zones._next);
|
|
||||||
_zones._next = NULL;
|
_zones._next = NULL;
|
||||||
|
|
||||||
_engineFlags &= ~kEngineQuit;
|
_engineFlags &= ~kEngineQuit;
|
||||||
|
|
||||||
_numLocations = atoi(s);
|
_numLocations = atoi(s);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue