CGE: Fixed several memory leaks of main objects

This commit is contained in:
Paul Gilbert 2011-07-12 21:53:07 +10:00
parent 891032053a
commit e2b19ad9b0
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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)