diff options
author | Hop311 <Hop3114@gmail.com> | 2023-09-09 23:49:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-09 23:49:54 +0200 |
commit | 6278a35f4704574933464700026d8deb997da5c1 (patch) | |
tree | eb36a9b030b263d825eb93638e64deb0dbd38a78 /src/openvic/GameManager.cpp | |
parent | bec619fc8f554cb075fcef2428f3b6bdb5e88e82 (diff) | |
parent | 3d7fbd9b376811ca0ed226fa78bcc8b6279ba8dc (diff) |
Merge pull request #14 from OpenVicProject/dataloading
Dataloading scaffolding + basic culture and pop history loading
Diffstat (limited to 'src/openvic/GameManager.cpp')
-rw-r--r-- | src/openvic/GameManager.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/openvic/GameManager.cpp b/src/openvic/GameManager.cpp deleted file mode 100644 index 580dc4b..0000000 --- a/src/openvic/GameManager.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "GameManager.hpp" - -#include "utility/Logger.hpp" - -using namespace OpenVic; - -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; - } -} - -/* REQUIREMENTS: - * SS-98, SS-101 - */ -void GameManager::tick() { - today++; - Logger::info("Tick: ", today); - map.tick(today); - set_needs_update(); -} - -return_t GameManager::setup() { - session_start = time(nullptr); - clock.reset(); - today = { 1836 }; - good_manager.reset_to_defaults(); - return_t ret = map.setup(good_manager, building_manager, pop_manager); - set_needs_update(); - return ret; -} - -Date const& GameManager::get_today() const { - return today; -} - -return_t GameManager::expand_building(index_t province_index, const std::string_view 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); -} |