diff options
author | Hop311 <Hop3114@gmail.com> | 2023-05-04 15:47:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 15:47:20 +0200 |
commit | 7791a18094efaf62377606a7e5a7cba85a4c7a64 (patch) | |
tree | cd3ebcae0f67b07488fadb31ba3b376b306e03f6 /extension/src/openvic2/GameManager.cpp | |
parent | 6fd8fc3a786370207508631e569c1e8f5ab0e4e3 (diff) | |
parent | 2420f8b8fdd2db84e053ebb2d7f6e4840171009e (diff) |
Merge pull request #106 from OpenVic2Project/simulation-submodule
Moved simulation code to separate submodule
Diffstat (limited to 'extension/src/openvic2/GameManager.cpp')
-rw-r--r-- | extension/src/openvic2/GameManager.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/extension/src/openvic2/GameManager.cpp b/extension/src/openvic2/GameManager.cpp deleted file mode 100644 index 036e610..0000000 --- a/extension/src/openvic2/GameManager.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "GameManager.hpp" - -#include "Logger.hpp" - -using namespace OpenVic2; - -GameManager::GameManager(state_updated_func_t state_updated_callback) - : clock { [this]() { tick(); }, [this]() { update_state(); } }, - state_updated { state_updated_callback } {} - -void GameManager::set_needs_update() { - needs_update = true; -} - -void GameManager::update_state() { - if (needs_update) { - Logger::info("Update: ", today); - map.update_state(today); - if (state_updated) state_updated(); - needs_update = false; - } -} - -void GameManager::tick() { - today++; - Logger::info("Tick: ", today); - map.tick(today); - set_needs_update(); -} - -return_t GameManager::setup() { - clock.reset(); - today = { 1836 }; - set_needs_update(); - return map.generate_province_buildings(building_manager); -} - -Date const& GameManager::get_today() const { - return today; -} - -return_t GameManager::expand_building(index_t province_index, std::string const& building_type_identifier) { - set_needs_update(); - Province* province = map.get_province_by_index(province_index); - if (province == nullptr) return FAILURE; - return province->expand_building(building_type_identifier); -} |