aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/statics.cpp19
-rw-r--r--engines/fullpipe/statics.h1
2 files changed, 12 insertions, 8 deletions
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index eb28b93f59..524eeff5d9 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -1429,14 +1429,17 @@ Movement::~Movement() {
if (!_currMovement) {
if (_updateFlag1) {
_dynamicPhases[0]->freePixelData();
- _dynamicPhases.remove_at(0);
+ delete _dynamicPhases.remove_at(0);
}
// FIXME: At this point, the last entry in _dynamicPhases is invalid
- for (uint i = 0; i < _dynamicPhases.size() - 1; i++)
- _dynamicPhases[i]->freePixelData();
-
- _dynamicPhases.clear();
+ for (uint i = 0; i < _dynamicPhases.size() - 1; i++) {
+ DynamicPhase *phase = _dynamicPhases[i];
+ if (phase != _staticsObj1 && phase != _staticsObj2)
+ delete phase;
+ else
+ _dynamicPhases[i]->freePixelData();
+ }
}
}
@@ -1844,12 +1847,12 @@ void Movement::removeFirstPhase() {
gotoNextFrame(0, 0);
if (!_currMovement) {
- _dynamicPhases.remove_at(0);
+ delete _dynamicPhases.remove_at(0);
for (uint i = 0; i < _dynamicPhases.size(); i++) {
- _framePosOffsets[i].x = _framePosOffsets[i + 1].x;
- _framePosOffsets[i].y = _framePosOffsets[i + 1].y;
+ _framePosOffsets[i] = _framePosOffsets[i + 1];
}
+ _framePosOffsets.pop_back();
}
_currDynamicPhaseIndex--;
}
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index fa893d6118..a30915316d 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -116,6 +116,7 @@ class Movement : public GameObject {
int _field_50;
int _counterMax;
int _counter;
+ /** a confusing mix of owned and unowned items */
Common::Array<DynamicPhase *> _dynamicPhases;
int _field_78;
PointList _framePosOffsets;