diff options
Diffstat (limited to 'engines/teenagent/teenagent.cpp')
-rw-r--r-- | engines/teenagent/teenagent.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index a14fffd77f..acfc0cbc17 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -73,10 +73,20 @@ TeenAgentEngine::TeenAgentEngine(OSystem *system, const ADGameDescription *gd) } TeenAgentEngine::~TeenAgentEngine() { - delete music; delete dialog; - res->deinit(); + dialog = 0; + delete scene; + scene = 0; + delete inventory; + inventory = 0; + delete music; + music = 0; + _mixer->stopAll(); + use_hotspots.clear(); delete res; + res = 0; + + CursorMan.popCursor(); delete console; DebugMan.clearAllDebugChannels(); @@ -206,19 +216,6 @@ void TeenAgentEngine::init() { } } -void TeenAgentEngine::deinit() { - _mixer->stopAll(); - delete scene; - scene = NULL; - delete inventory; - inventory = NULL; - //delete music; - //music = NULL; - use_hotspots.clear(); - res->deinit(); - CursorMan.popCursor(); -} - Common::Error TeenAgentEngine::loadGameState(int slot) { debug(0, "loading from slot %d", slot); Common::ScopedPtr<Common::InSaveFile> in(_saveFileMan->openForLoading(Common::String::format("teenagent.%02d", slot))); @@ -579,10 +576,8 @@ Common::Error TeenAgentEngine::run() { Object *current_object = scene->findObject(mouse); while (_event->pollEvent(event)) { - if (event.type == Common::EVENT_RTL) { - deinit(); + if (event.type == Common::EVENT_RTL) return Common::kNoError; - } if ((!scene_busy && inventory->processEvent(event)) || scene->processEvent(event)) continue; @@ -702,7 +697,6 @@ Common::Error TeenAgentEngine::run() { } } while (!shouldQuit()); - deinit(); return Common::kNoError; } |