aboutsummaryrefslogtreecommitdiff
path: root/src/openvic2/GameManager.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-16 20:59:39 +0200
committer Hop311 <hop3114@gmail.com>2023-05-16 20:59:39 +0200
commit42d9d1d5417deb5979a9d5775cfe97dcff4b77ba (patch)
tree440634772615531e704a5554aa59c9890cd9cd85 /src/openvic2/GameManager.cpp
parent339e0278a2064f7eeb152fe8c5778840b609e9f3 (diff)
Changed from OpenVic2 to OpenVic
Diffstat (limited to 'src/openvic2/GameManager.cpp')
-rw-r--r--src/openvic2/GameManager.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/openvic2/GameManager.cpp b/src/openvic2/GameManager.cpp
deleted file mode 100644
index 349c276..0000000
--- a/src/openvic2/GameManager.cpp
+++ /dev/null
@@ -1,49 +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() {
- session_start = time(nullptr);
- clock.reset();
- today = { 1836 };
- good_manager.reset_to_defaults();
- return_t ret = map.setup(good_manager, building_manager);
- set_needs_update();
- return ret;
-}
-
-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);
-}