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()
|
||||
_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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ void waitUntilLeftClick();
|
|||
|
||||
void addNode(Node *list, Node *n);
|
||||
void removeNode(Node *n);
|
||||
void freeNodeList(Node *list);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue