aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/InstanceManager.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-09-06 22:35:46 +0200
committer GitHub <noreply@github.com>2024-09-06 22:35:46 +0200
commitd36045735fc56e8cfe772713c2ef5012dad94ae3 (patch)
tree479bddfb6a01b2627118ee2b71adea4105fe8718 /src/openvic-simulation/InstanceManager.cpp
parent429765a8cdc93cc8975d2676d04cb628c21064a4 (diff)
parent34c8b1039a5a7982a84c718ca8625efcd940bbf5 (diff)
Merge pull request #192 from OpenVicProject/update-clock
Trigger gamestate update in headless mode + add `update_clock` functions
Diffstat (limited to 'src/openvic-simulation/InstanceManager.cpp')
-rw-r--r--src/openvic-simulation/InstanceManager.cpp10
1 files changed, 10 insertions, 0 deletions
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();