aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/GameManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/GameManager.cpp')
-rw-r--r--src/openvic-simulation/GameManager.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/openvic-simulation/GameManager.cpp b/src/openvic-simulation/GameManager.cpp
index 603a79a..fff806c 100644
--- a/src/openvic-simulation/GameManager.cpp
+++ b/src/openvic-simulation/GameManager.cpp
@@ -7,7 +7,8 @@ GameManager::GameManager(
) : simulation_clock {
std::bind(&GameManager::tick, this), std::bind(&GameManager::update_gamestate, this), clock_state_changed_callback
}, gamestate_updated { gamestate_updated_callback ? std::move(gamestate_updated_callback) : []() {} },
- session_start { 0 }, today {}, gamestate_needs_update { false }, currently_updating_gamestate { false } {}
+ session_start { 0 }, today {}, gamestate_needs_update { false }, currently_updating_gamestate { false },
+ map_instance { map_definition } {}
void GameManager::set_gamestate_needs_update() {
if (!currently_updating_gamestate) {
@@ -23,7 +24,7 @@ void GameManager::update_gamestate() {
}
currently_updating_gamestate = true;
Logger::info("Update: ", today);
- map.update_gamestate(today);
+ map_instance.update_gamestate(today);
gamestate_updated();
gamestate_needs_update = false;
currently_updating_gamestate = false;
@@ -35,7 +36,7 @@ void GameManager::update_gamestate() {
void GameManager::tick() {
today++;
Logger::info("Tick: ", today);
- map.tick(today);
+ map_instance.tick(today);
set_gamestate_needs_update();
}
@@ -44,7 +45,7 @@ bool GameManager::reset() {
simulation_clock.reset();
today = {};
economy_manager.get_good_manager().reset_to_defaults();
- bool ret = map.reset(economy_manager.get_building_type_manager());
+ bool ret = map_instance.reset(economy_manager.get_building_type_manager());
set_gamestate_needs_update();
return ret;
}
@@ -66,15 +67,15 @@ bool GameManager::load_bookmark(Bookmark const* new_bookmark) {
today = bookmark->get_date();
- ret &= map.apply_history_to_provinces(
+ ret &= map_instance.apply_history_to_provinces(
history_manager.get_province_manager(), today, politics_manager.get_ideology_manager(),
politics_manager.get_issue_manager(), *country_manager.get_country_by_identifier("ENG")
);
- ret &= map.get_state_manager().generate_states(map);
+ ret &= map_instance.get_state_manager().generate_states(map_instance);
ret &= country_instance_manager.generate_country_instances(country_manager);
ret &= country_instance_manager.apply_history_to_countries(
- history_manager.get_country_manager(), today, military_manager.get_unit_instance_manager(), map
+ history_manager.get_country_manager(), today, military_manager.get_unit_instance_manager(), map_instance
);
return ret;
@@ -82,7 +83,7 @@ bool GameManager::load_bookmark(Bookmark const* new_bookmark) {
bool GameManager::expand_selected_province_building(size_t building_index) {
set_gamestate_needs_update();
- ProvinceInstance* province = map.get_selected_province();
+ ProvinceInstance* province = map_instance.get_selected_province();
if (province == nullptr) {
Logger::error("Cannot expand building index ", building_index, " - no province selected!");
return false;