diff options
Diffstat (limited to 'src/openvic-simulation')
-rw-r--r-- | src/openvic-simulation/GameManager.cpp | 9 | ||||
-rw-r--r-- | src/openvic-simulation/GameManager.hpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/InstanceManager.cpp | 10 | ||||
-rw-r--r-- | src/openvic-simulation/InstanceManager.hpp | 1 |
4 files changed, 22 insertions, 0 deletions
diff --git a/src/openvic-simulation/GameManager.cpp b/src/openvic-simulation/GameManager.cpp index 2577b54..2980dbd 100644 --- a/src/openvic-simulation/GameManager.cpp +++ b/src/openvic-simulation/GameManager.cpp @@ -74,3 +74,12 @@ bool GameManager::start_game_session() { return instance_manager->start_game_session(); } + +bool GameManager::update_clock() { + if (!instance_manager) { + Logger::error("Cannot update clock - instance manager uninitialised!"); + return false; + } + + return instance_manager->update_clock(); +} diff --git a/src/openvic-simulation/GameManager.hpp b/src/openvic-simulation/GameManager.hpp index fdbcb6a..91de279 100644 --- a/src/openvic-simulation/GameManager.hpp +++ b/src/openvic-simulation/GameManager.hpp @@ -38,5 +38,7 @@ namespace OpenVic { bool setup_instance(Bookmark const* bookmark); bool start_game_session(); + + bool update_clock(); }; } diff --git a/src/openvic-simulation/InstanceManager.cpp b/src/openvic-simulation/InstanceManager.cpp index 1df6e90..ea30246 100644 --- a/src/openvic-simulation/InstanceManager.cpp +++ b/src/openvic-simulation/InstanceManager.cpp @@ -148,6 +148,16 @@ bool InstanceManager::start_game_session() { return true; } +bool InstanceManager::update_clock() { + if (!is_game_session_started()) { + Logger::error("Cannot update clock - game session not started!"); + return false; + } + + simulation_clock.conditionally_advance_game(); + return true; +} + bool InstanceManager::expand_selected_province_building(size_t building_index) { set_gamestate_needs_update(); ProvinceInstance* province = map_instance.get_selected_province(); diff --git a/src/openvic-simulation/InstanceManager.hpp b/src/openvic-simulation/InstanceManager.hpp index 9cf346a..cfb5447 100644 --- a/src/openvic-simulation/InstanceManager.hpp +++ b/src/openvic-simulation/InstanceManager.hpp @@ -58,6 +58,7 @@ namespace OpenVic { bool setup(); bool load_bookmark(Bookmark const* new_bookmark); bool start_game_session(); + bool update_clock(); bool expand_selected_province_building(size_t building_index); }; |