aboutsummaryrefslogtreecommitdiff
path: root/engines/cge2/hero.cpp
diff options
context:
space:
mode:
authoruruk2014-07-07 23:58:06 +0200
committeruruk2014-07-07 23:58:06 +0200
commitbe5ec466b3028f15a8aa51331426b3cd317fe789 (patch)
tree87650ef811c6ebb35fedb085ca248759ee802c15 /engines/cge2/hero.cpp
parent10a37ea478050c37d368f31815fb189f4c7af7b1 (diff)
downloadscummvm-rg350-be5ec466b3028f15a8aa51331426b3cd317fe789.tar.gz
scummvm-rg350-be5ec466b3028f15a8aa51331426b3cd317fe789.tar.bz2
scummvm-rg350-be5ec466b3028f15a8aa51331426b3cd317fe789.zip
CGE2: Fix another probable memory-leak source.
Diffstat (limited to 'engines/cge2/hero.cpp')
-rw-r--r--engines/cge2/hero.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp
index 393aa4b87c..f9c9996604 100644
--- a/engines/cge2/hero.cpp
+++ b/engines/cge2/hero.cpp
@@ -34,6 +34,10 @@ namespace CGE2 {
Hero::Hero(CGE2Engine *vm)
: Sprite(vm), _contact(nullptr), _dir(kNoDir),
_curDim(0), _tracePtr(-1), _ignoreMap(false) {
+
+ for (int i = 0; i < kDimMax; i++) {
+ _dim[i] = nullptr;
+ }
}
Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bother with "labels" for example. TODO: Try to unify the two later!
@@ -210,6 +214,15 @@ Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bo
return this;
}
+Sprite *Hero::contract() {
+ for (int i = 0; i < kDimMax; i++) {
+ if (_dim[i] != nullptr)
+ delete[] _dim[i];
+ }
+
+ return this;
+}
+
void Hero::setCurrent() {
FXP m = _vm->_eye->_z / (_pos3D._z - _vm->_eye->_z);
FXP tmp = m * _siz.y;