From e2b19ad9b0bc3e2a437eaab3aaa62302e0e892d3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2011 21:53:07 +1000 Subject: CGE: Fixed several memory leaks of main objects --- engines/cge/cge.cpp | 4 +++- engines/cge/cge_main.cpp | 4 +--- 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) -- cgit v1.2.3