aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-07-12 21:53:07 +1000
committerPaul Gilbert2011-07-12 21:53:07 +1000
commite2b19ad9b0bc3e2a437eaab3aaa62302e0e892d3 (patch)
tree0263e3481ee78c9de39290574a8d0678c42a07c3
parent891032053a19f0962771f4374cd79ee66f2f9b0f (diff)
downloadscummvm-rg350-e2b19ad9b0bc3e2a437eaab3aaa62302e0e892d3.tar.gz
scummvm-rg350-e2b19ad9b0bc3e2a437eaab3aaa62302e0e892d3.tar.bz2
scummvm-rg350-e2b19ad9b0bc3e2a437eaab3aaa62302e0e892d3.zip
CGE: Fixed several memory leaks of main objects
-rw-r--r--engines/cge/cge.cpp4
-rw-r--r--engines/cge/cge_main.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 55b79d5b35..884af2cd46 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -74,8 +74,10 @@ void CGEEngine::setup() {
_heart = new Heart;
_sys = new System(this);
_pocLight = new PocLight(this);
- for (int i = 0; i < POCKET_NX; i++)
+ for (int i = 0; i < POCKET_NX; i++) {
_pocket[i] = new Sprite(this, NULL);
+ _pocket[i]->_flags._kill = false;
+ }
_sprite = new Sprite(this, NULL);
_miniCave = new Sprite(this, NULL);
_miniCave->_flags._kill = false;
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index d35a985d89..6f741f1598 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -1631,6 +1631,7 @@ void CGEEngine::runGame() {
_hero->gotoxy(_heroXY[_now - 1]._x, _heroXY[_now - 1]._y);
if (INI_FILE::exist("00SHADOW.SPR")) {
loadSprite("00SHADOW", -1, 0, _hero->_x + 14, _hero->_y + 51);
+ delete _shadow;
if ((_shadow = _sprite) != NULL) {
_shadow->_ref = 2;
_shadow->_flags._tran = true;
@@ -1850,9 +1851,6 @@ void CGEEngine::cge_main() {
_debugLine->_flags._hide = true;
_horzLine->_flags._hide = true;
- //srand((uint16) Timer());
- _sys = new System(this);
-
if (_music && Startup::_soundOk)
loadMidi(0);
if (Startup::_mode < 2)