aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/main_game_window.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-22 13:28:32 -0400
committerPaul Gilbert2016-07-22 13:28:32 -0400
commit03b45f44dfdb86a9607aaa09a02e5c57968e275f (patch)
tree189fb7ac253cc3566e9071eec75a8d6f22c38685 /engines/titanic/main_game_window.cpp
parent41a3c83bc6444550c9e4ea1a5918450403e0e5ee (diff)
downloadscummvm-rg350-03b45f44dfdb86a9607aaa09a02e5c57968e275f.tar.gz
scummvm-rg350-03b45f44dfdb86a9607aaa09a02e5c57968e275f.tar.bz2
scummvm-rg350-03b45f44dfdb86a9607aaa09a02e5c57968e275f.zip
TITANIC: Workaround for original using destroyed objects after save load
The original loads savegames by loading a new project hierarchy and then deleting and replacing the existing one. This means that objects in the original project, such as the PET control, are destroyed, leaving the remainder of the PET code that called load operating on destroyed objects. This workaround instead flags for a load to be done, and adds new code in the game manager to take care of it. This way, the remainder of the PET event handling can finish first, and it will be then safe to destroy the original game project (including PET) and load the new savegame.
Diffstat (limited to 'engines/titanic/main_game_window.cpp')
-rw-r--r--engines/titanic/main_game_window.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 73ce375881..3c549c4e89 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -36,6 +36,7 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) {
_inputAllowed = false;
_image = nullptr;
_cursor = nullptr;
+ _pendingLoadSlot = -1;
}
bool CMainGameWindow::Create() {
@@ -137,6 +138,12 @@ void CMainGameWindow::draw() {
g_vm->_filesManager->debug(scrManager);
break;
+ case GSMODE_PENDING_LOAD:
+ // Pending savegame to load
+ _gameManager->_gameState.setMode(GSMODE_SELECTED);
+ _vm->_window->_project->loadGame(_pendingLoadSlot);
+ break;
+
default:
break;
}
@@ -190,4 +197,9 @@ void CMainGameWindow::mouseChanged() {
_gameManager->update();
}
+void CMainGameWindow::loadGame(int slotId) {
+ _pendingLoadSlot = slotId;
+ _gameManager->_gameState.setMode(GSMODE_PENDING_LOAD);
+}
+
} // End of namespace Titanic