aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lastexpress')
-rw-r--r--engines/lastexpress/entities/entity.cpp11
-rw-r--r--engines/lastexpress/entities/entity.h2
-rw-r--r--engines/lastexpress/game/entities.cpp6
3 files changed, 15 insertions, 4 deletions
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 7e76123b5b..38b3dec09f 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -27,6 +27,8 @@
#include "lastexpress/entities/entity_intern.h"
+#include "lastexpress/data/sequence.h"
+
#include "lastexpress/game/action.h"
#include "lastexpress/game/entities.h"
#include "lastexpress/game/logic.h"
@@ -46,6 +48,15 @@ namespace LastExpress {
// EntityData
//////////////////////////////////////////////////////////////////////////
+EntityData::EntityCallData::~EntityCallData() {
+ SAFE_DELETE(frame);
+ SAFE_DELETE(frame1);
+
+ SAFE_DELETE(sequence);
+ SAFE_DELETE(sequence2);
+ SAFE_DELETE(sequence3);
+}
+
void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) {
for (uint i = 0; i < ARRAYSIZE(callbacks); i++)
s.syncAsByte(callbacks[i]);
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 9a2b0ffe25..ccef312cd6 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -570,6 +570,8 @@ public:
sequence3 = NULL;
}
+ ~EntityCallData();
+
/**
* Convert this object into a string representation.
*
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 639470d502..e5219787c5 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -607,10 +607,8 @@ void Entities::resetSequences(EntityIndex entityIndex) const {
getData(entityIndex)->currentFrame = -1;
}
- // FIXME: in the original engine, the sequence pointers might just be copies,
- // make sure we free the associated memory at some point
- getData(entityIndex)->frame = NULL;
- getData(entityIndex)->frame1 = NULL;
+ SAFE_DELETE(getData(entityIndex)->frame);
+ SAFE_DELETE(getData(entityIndex)->frame1);
SAFE_DELETE(getData(entityIndex)->sequence);
SAFE_DELETE(getData(entityIndex)->sequence2);