diff options
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 14 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_demo.cpp | 8 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_demo.h | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_logic.cpp | 14 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_logic.h | 2 | ||||
-rw-r--r-- | engines/tsage/scenes.h | 2 | ||||
-rw-r--r-- | engines/tsage/tsage.cpp | 4 |
8 files changed, 46 insertions, 2 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 156062d0d6..d413c2e035 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -240,6 +240,20 @@ Scene *BlueForceGame::createScene(int sceneNumber) { } } +/** + * Returns true if it is currently okay to restore a game + */ +bool BlueForceGame::canLoadGameStateCurrently() { + return true; +} + +/** + * Returns true if it is currently okay to save the game + */ +bool BlueForceGame::canSaveGameStateCurrently() { + return true; +} + void BlueForceGame::rightClick() { RightClickDialog *dlg = new RightClickDialog(); dlg->execute(); diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 8764d0b856..2ebfc19c26 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -43,6 +43,8 @@ public: virtual Scene *createScene(int sceneNumber); virtual void rightClick(); virtual void processEvent(Event &event); + virtual bool canSaveGameStateCurrently(); + virtual bool canLoadGameStateCurrently(); }; #define OBJ_ARRAY_SIZE 10 diff --git a/engines/tsage/ringworld/ringworld_demo.cpp b/engines/tsage/ringworld/ringworld_demo.cpp index adf4aae9dd..fedb19c804 100644 --- a/engines/tsage/ringworld/ringworld_demo.cpp +++ b/engines/tsage/ringworld/ringworld_demo.cpp @@ -41,6 +41,14 @@ Scene *RingworldDemoGame::createScene(int sceneNumber) { return new RingworldDemoScene(); } +bool RingworldDemoGame::canLoadGameStateCurrently() { + return false; +} + +bool RingworldDemoGame::canSaveGameStateCurrently() { + return false; +} + void RingworldDemoGame::quitGame() { if (MessageDialog::show(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING) == 0) g_vm->quitGame(); diff --git a/engines/tsage/ringworld/ringworld_demo.h b/engines/tsage/ringworld/ringworld_demo.h index 30527b0aea..7c0ac39285 100644 --- a/engines/tsage/ringworld/ringworld_demo.h +++ b/engines/tsage/ringworld/ringworld_demo.h @@ -44,6 +44,8 @@ public: virtual Scene *createScene(int sceneNumber); virtual void quitGame(); virtual void processEvent(Event &event); + virtual bool canSaveGameStateCurrently(); + virtual bool canLoadGameStateCurrently(); }; class RingworldDemoScene: public Scene { diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index e3b5370ae2..5254fe66d7 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -192,6 +192,20 @@ Scene *RingworldGame::createScene(int sceneNumber) { } } +/** + * Returns true if it is currently okay to restore a game + */ +bool RingworldGame::canLoadGameStateCurrently() { + return !g_globals->getFlag(50); +} + +/** + * Returns true if it is currently okay to save the game + */ +bool RingworldGame::canSaveGameStateCurrently() { + return !g_globals->getFlag(50); +} + /*--------------------------------------------------------------------------*/ DisplayHotspot::DisplayHotspot(int regionId, ...) { diff --git a/engines/tsage/ringworld/ringworld_logic.h b/engines/tsage/ringworld/ringworld_logic.h index 6adc8c41da..6f6a66cc26 100644 --- a/engines/tsage/ringworld/ringworld_logic.h +++ b/engines/tsage/ringworld/ringworld_logic.h @@ -155,6 +155,8 @@ public: virtual Scene *createScene(int sceneNumber); virtual void processEvent(Event &event); virtual void rightClick(); + virtual bool canSaveGameStateCurrently(); + virtual bool canLoadGameStateCurrently(); }; class NamedHotspot : public SceneHotspot { diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index da813f019a..202648a1a8 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -133,6 +133,8 @@ public: virtual Scene *createScene(int sceneNumber) = 0; virtual void processEvent(Event &event) {} virtual void rightClick() {} + virtual bool canSaveGameStateCurrently() = 0; + virtual bool canLoadGameStateCurrently() = 0; }; } // End of namespace TsAGE diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 90fdecc90b..5b0e0b66ee 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -119,14 +119,14 @@ Common::Error TSageEngine::run() { * Returns true if it is currently okay to restore a game */ bool TSageEngine::canLoadGameStateCurrently() { - return (g_globals->getFlag(50) == 0); + return (g_globals != NULL) && (g_globals->_game != NULL) && g_globals->_game->canLoadGameStateCurrently(); } /** * Returns true if it is currently okay to save the game */ bool TSageEngine::canSaveGameStateCurrently() { - return (g_globals->getFlag(50) == 0); + return (g_globals != NULL) && (g_globals->_game != NULL) && g_globals->_game->canSaveGameStateCurrently(); } /** |