diff options
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 27 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/modal.h | 1 |
3 files changed, 19 insertions, 11 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 6f8e642cc6..f50593cc3a 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -230,6 +230,8 @@ bool FullpipeEngine::shouldQuit() { } Common::Error FullpipeEngine::loadGameState(int slot) { + deleteModalObject(); + if (_gameLoader->readSavegame(getSavegameFile(slot))) return Common::kNoError; else @@ -343,11 +345,7 @@ void FullpipeEngine::updateEvents() { if (_modalObject->init(42)) { _modalObject->update(); } else { - _modalObject->saveload(); - BaseModalObject *obj = _modalObject->_parentObj; - if (obj) - delete _modalObject; - _modalObject = obj; + deleteModalObject(); } } else { _gameLoader->updateSystems(42); @@ -470,6 +468,18 @@ void FullpipeEngine::cleanup() { stopAllSoundStreams(); } +void FullpipeEngine::deleteModalObject() { + if (!_modalObject) + return; + + _modalObject->saveload(); + BaseModalObject *tmp = _modalObject->_parentObj; + + delete _modalObject; + + _modalObject = tmp; +} + void FullpipeEngine::updateScreen() { debugC(4, kDebugDrawing, "FullpipeEngine::updateScreen()"); @@ -484,12 +494,7 @@ void FullpipeEngine::updateScreen() { if (_modalObject->init(42)) { _modalObject->update(); } else { - _modalObject->saveload(); - BaseModalObject *tmp = _modalObject->_parentObj; - - delete _modalObject; - - _modalObject = tmp; + deleteModalObject(); } } } else if (_currentScene) { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index cd7b120952..2039989c91 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -225,6 +225,8 @@ public: Common::Array<Common::Point> _arcadeKeys; + void deleteModalObject(); + void initMap(); void updateMap(PreloadItem *pre); void updateMapPiece(int mapId, int update); diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 1bc576c70e..9f5e4088cb 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -51,6 +51,7 @@ class BaseModalObject { BaseModalObject() : _parentObj(0) { _objtype = kObjTypeDefault; } virtual ~BaseModalObject() {} + void deleteObject(); virtual bool pollEvent() = 0; virtual bool handleMessage(ExCommand *message) = 0; |