aboutsummaryrefslogtreecommitdiff
path: root/GameManager.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-03 20:37:26 +0200
committer Hop311 <hop3114@gmail.com>2023-05-03 20:37:26 +0200
commit64bbf86b623a3cca2eaf9009d7acdcde067592e3 (patch)
tree5d607f28019675c9eaaa2883acf036717fa45b2f /GameManager.cpp
parentc92481448159d3a363d6a99b3025bd2358c3dab6 (diff)
Moved code to src/openvic2
Diffstat (limited to 'GameManager.cpp')
-rw-r--r--GameManager.cpp46
1 files changed, 0 insertions, 46 deletions
diff --git a/GameManager.cpp b/GameManager.cpp
deleted file mode 100644
index 58e40bb..0000000
--- a/GameManager.cpp
+++ /dev/null
@@ -1,46 +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);
-}