aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-06-13 00:24:00 +0200
committer hop311 <hop3114@gmail.com>2024-06-13 00:24:00 +0200
commit4b39e77304094708d5c503b6a221386408cc4409 (patch)
tree7ba5a06714c267185dd3a59aabc6556a105c122f /src/openvic-simulation/history
parentc0ba822ee46551a40ad6b43e8f56b80e27ae35b5 (diff)
Separated GameManager into Definition and Instance Managersinstance-definition-managers
Diffstat (limited to 'src/openvic-simulation/history')
-rw-r--r--src/openvic-simulation/history/CountryHistory.cpp32
-rw-r--r--src/openvic-simulation/history/CountryHistory.hpp4
-rw-r--r--src/openvic-simulation/history/DiplomaticHistory.cpp30
-rw-r--r--src/openvic-simulation/history/DiplomaticHistory.hpp4
-rw-r--r--src/openvic-simulation/history/HistoryMap.cpp10
-rw-r--r--src/openvic-simulation/history/HistoryMap.hpp30
-rw-r--r--src/openvic-simulation/history/ProvinceHistory.cpp43
-rw-r--r--src/openvic-simulation/history/ProvinceHistory.hpp18
8 files changed, 90 insertions, 81 deletions
diff --git a/src/openvic-simulation/history/CountryHistory.cpp b/src/openvic-simulation/history/CountryHistory.cpp
index 9ef230e..b316353 100644
--- a/src/openvic-simulation/history/CountryHistory.cpp
+++ b/src/openvic-simulation/history/CountryHistory.cpp
@@ -1,6 +1,6 @@
#include "CountryHistory.hpp"
-#include "openvic-simulation/GameManager.hpp"
+#include "openvic-simulation/DefinitionManager.hpp"
using namespace OpenVic;
using namespace OpenVic::NodeTools;
@@ -15,19 +15,19 @@ std::unique_ptr<CountryHistoryEntry> CountryHistoryMap::_make_entry(Date date) c
}
bool CountryHistoryMap::_load_history_entry(
- GameManager const& game_manager, Dataloader const& dataloader, DeploymentManager& deployment_manager,
+ DefinitionManager const& definition_manager, Dataloader const& dataloader, DeploymentManager& deployment_manager,
CountryHistoryEntry& entry, ast::NodeCPtr root
) {
- PoliticsManager const& politics_manager = game_manager.get_politics_manager();
+ PoliticsManager const& politics_manager = definition_manager.get_politics_manager();
IssueManager const& issue_manager = politics_manager.get_issue_manager();
- CultureManager const& culture_manager = game_manager.get_pop_manager().get_culture_manager();
- CountryManager const& country_manager = game_manager.get_country_manager();
- TechnologyManager const& technology_manager = game_manager.get_research_manager().get_technology_manager();
- InventionManager const& invention_manager = game_manager.get_research_manager().get_invention_manager();
- DecisionManager const& decision_manager = game_manager.get_decision_manager();
+ CultureManager const& culture_manager = definition_manager.get_pop_manager().get_culture_manager();
+ CountryManager const& country_manager = definition_manager.get_country_manager();
+ TechnologyManager const& technology_manager = definition_manager.get_research_manager().get_technology_manager();
+ InventionManager const& invention_manager = definition_manager.get_research_manager().get_invention_manager();
+ DecisionManager const& decision_manager = definition_manager.get_decision_manager();
return expect_dictionary_keys_and_default(
- [this, &game_manager, &dataloader, &deployment_manager, &issue_manager, &technology_manager, &invention_manager,
+ [this, &definition_manager, &dataloader, &deployment_manager, &issue_manager, &technology_manager, &invention_manager,
&country_manager, &entry](std::string_view key, ast::NodeCPtr value) -> bool {
ReformGroup const* reform_group = issue_manager.get_reform_group_by_identifier(key);
if (reform_group != nullptr) {
@@ -64,10 +64,10 @@ bool CountryHistoryMap::_load_history_entry(
}
return _load_history_sub_entry_callback(
- game_manager, dataloader, deployment_manager, entry.get_date(), value, key, value
+ definition_manager, dataloader, deployment_manager, entry.get_date(), value, key, value
);
},
- "capital", ZERO_OR_ONE, game_manager.get_map_definition().expect_province_definition_identifier(
+ "capital", ZERO_OR_ONE, definition_manager.get_map_definition().expect_province_definition_identifier(
assign_variable_callback_pointer_opt(entry.capital)
),
"primary_culture", ZERO_OR_ONE,
@@ -75,7 +75,7 @@ bool CountryHistoryMap::_load_history_entry(
"culture", ZERO_OR_MORE, culture_manager.expect_culture_identifier(
vector_callback_pointer(entry.accepted_cultures)
),
- "religion", ZERO_OR_ONE, game_manager.get_pop_manager().get_religion_manager().expect_religion_identifier(
+ "religion", ZERO_OR_ONE, definition_manager.get_pop_manager().get_religion_manager().expect_religion_identifier(
assign_variable_callback_pointer_opt(entry.religion)
),
"government", ZERO_OR_ONE, politics_manager.get_government_type_manager().expect_government_type_identifier(
@@ -96,9 +96,9 @@ bool CountryHistoryMap::_load_history_entry(
}
),
"oob", ZERO_OR_ONE, expect_identifier_or_string(
- [&game_manager, &deployment_manager, &dataloader, &entry](std::string_view path) -> bool {
+ [&definition_manager, &deployment_manager, &dataloader, &entry](std::string_view path) -> bool {
Deployment const* deployment = nullptr;
- const bool ret = deployment_manager.load_oob_file(game_manager, dataloader, path, deployment, false);
+ const bool ret = deployment_manager.load_oob_file(definition_manager, dataloader, path, deployment, false);
if (deployment != nullptr) {
entry.inital_oob = deployment;
}
@@ -215,7 +215,7 @@ CountryHistoryMap const* CountryHistoryManager::get_country_history(Country cons
}
bool CountryHistoryManager::load_country_history_file(
- GameManager& game_manager, Dataloader const& dataloader, Country const& country, ast::NodeCPtr root
+ DefinitionManager& definition_manager, Dataloader const& dataloader, Country const& country, ast::NodeCPtr root
) {
if (locked) {
Logger::error("Attempted to load country history file for ", country, " after country history registry was locked!");
@@ -240,6 +240,6 @@ bool CountryHistoryManager::load_country_history_file(
CountryHistoryMap& country_history = it.value();
return country_history._load_history_file(
- game_manager, dataloader, game_manager.get_military_manager().get_deployment_manager(), root
+ definition_manager, dataloader, definition_manager.get_military_manager().get_deployment_manager(), root
);
}
diff --git a/src/openvic-simulation/history/CountryHistory.hpp b/src/openvic-simulation/history/CountryHistory.hpp
index b183ea8..cf934f5 100644
--- a/src/openvic-simulation/history/CountryHistory.hpp
+++ b/src/openvic-simulation/history/CountryHistory.hpp
@@ -78,7 +78,7 @@ namespace OpenVic {
std::unique_ptr<CountryHistoryEntry> _make_entry(Date date) const override;
bool _load_history_entry(
- GameManager const& game_manager, Dataloader const& dataloader, DeploymentManager& deployment_manager,
+ DefinitionManager const& definition_manager, Dataloader const& dataloader, DeploymentManager& deployment_manager,
CountryHistoryEntry& entry, ast::NodeCPtr root
) override;
};
@@ -98,7 +98,7 @@ namespace OpenVic {
CountryHistoryMap const* get_country_history(Country const* country) const;
bool load_country_history_file(
- GameManager& game_manager, Dataloader const& dataloader, Country const& country, ast::NodeCPtr root
+ DefinitionManager& definition_manager, Dataloader const& dataloader, Country const& country, ast::NodeCPtr root
);
};
diff --git a/src/openvic-simulation/history/DiplomaticHistory.cpp b/src/openvic-simulation/history/DiplomaticHistory.cpp
index c8aa934..c9b2379 100644
--- a/src/openvic-simulation/history/DiplomaticHistory.cpp
+++ b/src/openvic-simulation/history/DiplomaticHistory.cpp
@@ -1,6 +1,6 @@
#include "DiplomaticHistory.hpp"
-#include "openvic-simulation/GameManager.hpp"
+#include "openvic-simulation/DefinitionManager.hpp"
using namespace OpenVic;
using namespace OpenVic::NodeTools;
@@ -203,7 +203,7 @@ bool DiplomaticHistoryManager::load_diplomacy_history_file(CountryManager const&
)(root);
}
-bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_manager, ast::NodeCPtr root) {
+bool DiplomaticHistoryManager::load_war_history_file(DefinitionManager const& definition_manager, ast::NodeCPtr root) {
std::string_view name {};
std::vector<WarHistory::war_participant_t> attackers {};
std::vector<WarHistory::war_participant_t> defenders {};
@@ -211,13 +211,13 @@ bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_man
Date current_date {};
bool ret = expect_dictionary_keys_and_default(
- [&game_manager, &attackers, &defenders, &wargoals, &current_date, &name](
+ [&definition_manager, &attackers, &defenders, &wargoals, &current_date, &name](
std::string_view key, ast::NodeCPtr node
) -> bool {
bool ret = expect_date_str(assign_variable_callback(current_date))(key);
ret &= expect_dictionary_keys(
- "add_attacker", ZERO_OR_MORE, game_manager.get_country_manager().expect_country_identifier(
+ "add_attacker", ZERO_OR_MORE, definition_manager.get_country_manager().expect_country_identifier(
[&attackers, &current_date, &name](Country const& country) -> bool {
for (auto const& attacker : attackers) {
if (attacker.get_country() == &country) {
@@ -234,7 +234,7 @@ bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_man
return true;
}
),
- "add_defender", ZERO_OR_MORE, game_manager.get_country_manager().expect_country_identifier(
+ "add_defender", ZERO_OR_MORE, definition_manager.get_country_manager().expect_country_identifier(
[&defenders, &current_date, &name](Country const& country) -> bool {
for (auto const& defender : defenders) {
if (defender.get_country() == &country) {
@@ -251,7 +251,7 @@ bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_man
return true;
}
),
- "rem_attacker", ZERO_OR_MORE, game_manager.get_country_manager().expect_country_identifier(
+ "rem_attacker", ZERO_OR_MORE, definition_manager.get_country_manager().expect_country_identifier(
[&attackers, &current_date, &name](Country const& country) -> bool {
WarHistory::war_participant_t* participant_to_remove = nullptr;
@@ -274,7 +274,7 @@ bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_man
return participant_to_remove->period.try_set_end(current_date);
}
),
- "rem_defender", ZERO_OR_MORE, game_manager.get_country_manager().expect_country_identifier(
+ "rem_defender", ZERO_OR_MORE, definition_manager.get_country_manager().expect_country_identifier(
[&defenders, &current_date, &name](Country const& country) -> bool {
WarHistory::war_participant_t* participant_to_remove = nullptr;
@@ -297,7 +297,7 @@ bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_man
return participant_to_remove->period.try_set_end(current_date);
}
),
- "war_goal", ZERO_OR_MORE, [&game_manager, &wargoals, &current_date](ast::NodeCPtr value) -> bool {
+ "war_goal", ZERO_OR_MORE, [&definition_manager, &wargoals, &current_date](ast::NodeCPtr value) -> bool {
Country const* actor = nullptr;
Country const* receiver = nullptr;
WargoalType const* type = nullptr;
@@ -306,23 +306,21 @@ bool DiplomaticHistoryManager::load_war_history_file(GameManager const& game_man
bool ret = expect_dictionary_keys(
"actor", ONE_EXACTLY,
- game_manager.get_country_manager().expect_country_identifier(
+ definition_manager.get_country_manager().expect_country_identifier(
assign_variable_callback_pointer(actor)
),
"receiver", ONE_EXACTLY,
- game_manager.get_country_manager().expect_country_identifier(
+ definition_manager.get_country_manager().expect_country_identifier(
assign_variable_callback_pointer(receiver)
),
- "casus_belli", ONE_EXACTLY,
- game_manager.get_military_manager().get_wargoal_type_manager().expect_wargoal_type_identifier(
- assign_variable_callback_pointer(type)
- ),
+ "casus_belli", ONE_EXACTLY, definition_manager.get_military_manager().get_wargoal_type_manager()
+ .expect_wargoal_type_identifier(assign_variable_callback_pointer(type)),
"country", ZERO_OR_ONE,
- game_manager.get_country_manager().expect_country_identifier(
+ definition_manager.get_country_manager().expect_country_identifier(
assign_variable_callback_pointer(*third_party)
),
"state_province_id", ZERO_OR_ONE,
- game_manager.get_map_definition().expect_province_definition_identifier(
+ definition_manager.get_map_definition().expect_province_definition_identifier(
assign_variable_callback_pointer(*target)
)
)(value);
diff --git a/src/openvic-simulation/history/DiplomaticHistory.hpp b/src/openvic-simulation/history/DiplomaticHistory.hpp
index 7ae5114..6055806 100644
--- a/src/openvic-simulation/history/DiplomaticHistory.hpp
+++ b/src/openvic-simulation/history/DiplomaticHistory.hpp
@@ -101,7 +101,7 @@ namespace OpenVic {
};
struct CountryManager;
- struct GameManager;
+ struct DefinitionManager;
struct DiplomaticHistoryManager {
private:
@@ -126,6 +126,6 @@ namespace OpenVic {
std::vector<WarHistory const*> get_wars(Date date) const;
bool load_diplomacy_history_file(CountryManager const& country_manager, ast::NodeCPtr root);
- bool load_war_history_file(GameManager const& game_manager, ast::NodeCPtr root);
+ bool load_war_history_file(DefinitionManager const& definition_manager, ast::NodeCPtr root);
};
}
diff --git a/src/openvic-simulation/history/HistoryMap.cpp b/src/openvic-simulation/history/HistoryMap.cpp
index 7b5353f..cbce5c3 100644
--- a/src/openvic-simulation/history/HistoryMap.cpp
+++ b/src/openvic-simulation/history/HistoryMap.cpp
@@ -1,15 +1,15 @@
#include "HistoryMap.hpp"
-#include "openvic-simulation/GameManager.hpp"
+#include "openvic-simulation/DefinitionManager.hpp"
using namespace OpenVic;
HistoryEntry::HistoryEntry(Date new_date) : date { new_date } {}
-Date _HistoryMapHelperFuncs::_get_start_date(GameManager const& game_manager) {
- return game_manager.get_define_manager().get_start_date();
+Date _HistoryMapHelperFuncs::_get_start_date(DefinitionManager const& definition_manager) {
+ return definition_manager.get_define_manager().get_start_date();
}
-Date _HistoryMapHelperFuncs::_get_end_date(GameManager const& game_manager) {
- return game_manager.get_define_manager().get_end_date();
+Date _HistoryMapHelperFuncs::_get_end_date(DefinitionManager const& definition_manager) {
+ return definition_manager.get_define_manager().get_end_date();
}
diff --git a/src/openvic-simulation/history/HistoryMap.hpp b/src/openvic-simulation/history/HistoryMap.hpp
index 15f838d..1d6ec03 100644
--- a/src/openvic-simulation/history/HistoryMap.hpp
+++ b/src/openvic-simulation/history/HistoryMap.hpp
@@ -16,12 +16,12 @@ namespace OpenVic {
HistoryEntry(Date new_date);
};
- struct GameManager;
+ struct DefinitionManager;
namespace _HistoryMapHelperFuncs {
/* Helper functions to avoid cyclic dependency issues */
- Date _get_start_date(GameManager const& game_manager);
- Date _get_end_date(GameManager const& game_manager);
+ Date _get_start_date(DefinitionManager const& definition_manager);
+ Date _get_end_date(DefinitionManager const& definition_manager);
}
template<std::derived_from<HistoryEntry> _Entry, typename... Args>
@@ -31,10 +31,12 @@ namespace OpenVic {
private:
ordered_map<Date, std::unique_ptr<entry_type>> PROPERTY(entries);
- bool _try_load_history_entry(GameManager const& game_manager, Args... args, Date date, ast::NodeCPtr root) {
- entry_type *const entry = _get_or_make_entry(game_manager, date);
+ bool _try_load_history_entry(
+ DefinitionManager const& definition_manager, Args... args, Date date, ast::NodeCPtr root
+ ) {
+ entry_type *const entry = _get_or_make_entry(definition_manager, date);
if (entry != nullptr) {
- return _load_history_entry(game_manager, args..., *entry, root);
+ return _load_history_entry(definition_manager, args..., *entry, root);
} else {
return false;
}
@@ -46,15 +48,17 @@ namespace OpenVic {
virtual std::unique_ptr<entry_type> _make_entry(Date date) const = 0;
virtual bool _load_history_entry(
- GameManager const& game_manager, Args... args, entry_type& entry, ast::NodeCPtr root
+ DefinitionManager const& definition_manager, Args... args, entry_type& entry, ast::NodeCPtr root
) = 0;
- bool _load_history_file(GameManager const& game_manager, Args... args, ast::NodeCPtr root) {
- return _try_load_history_entry(game_manager, args..., _HistoryMapHelperFuncs::_get_start_date(game_manager), root);
+ bool _load_history_file(DefinitionManager const& definition_manager, Args... args, ast::NodeCPtr root) {
+ return _try_load_history_entry(
+ definition_manager, args..., _HistoryMapHelperFuncs::_get_start_date(definition_manager), root
+ );
}
bool _load_history_sub_entry_callback(
- GameManager const& game_manager, Args... args, Date date, ast::NodeCPtr root, std::string_view key,
+ DefinitionManager const& definition_manager, Args... args, Date date, ast::NodeCPtr root, std::string_view key,
ast::NodeCPtr value, NodeTools::key_value_callback_t default_callback = NodeTools::key_value_invalid_callback
) {
/* Date blocks (loaded into the corresponding HistoryEntry) */
@@ -68,7 +72,7 @@ namespace OpenVic {
if (sub_date == date) {
Logger::warning("History entry ", sub_date, " defined with same date as parent entry");
}
- if (_try_load_history_entry(game_manager, args..., sub_date, value)) {
+ if (_try_load_history_entry(definition_manager, args..., sub_date, value)) {
return true;
} else {
Logger::error("Failed to load history entry at date ", sub_date);
@@ -80,8 +84,8 @@ namespace OpenVic {
}
/* Returns history entry at specific date, if date doesn't have an entry creates one, if that fails returns nullptr. */
- entry_type* _get_or_make_entry(GameManager const& game_manager, Date date) {
- const Date end_date = _HistoryMapHelperFuncs::_get_end_date(game_manager);
+ entry_type* _get_or_make_entry(DefinitionManager const& definition_manager, Date date) {
+ const Date end_date = _HistoryMapHelperFuncs::_get_end_date(definition_manager);
if (date > end_date) {
Logger::error("History entry ", date, " defined after end date ", end_date);
return nullptr;
diff --git a/src/openvic-simulation/history/ProvinceHistory.cpp b/src/openvic-simulation/history/ProvinceHistory.cpp
index c4d92b8..ffbda51 100644
--- a/src/openvic-simulation/history/ProvinceHistory.cpp
+++ b/src/openvic-simulation/history/ProvinceHistory.cpp
@@ -1,6 +1,6 @@
#include "ProvinceHistory.hpp"
-#include "openvic-simulation/GameManager.hpp"
+#include "openvic-simulation/DefinitionManager.hpp"
#include "openvic-simulation/map/ProvinceDefinition.hpp"
using namespace OpenVic;
@@ -16,13 +16,14 @@ std::unique_ptr<ProvinceHistoryEntry> ProvinceHistoryMap::_make_entry(Date date)
}
bool ProvinceHistoryMap::_load_history_entry(
- GameManager const& game_manager, ProvinceHistoryEntry& entry, ast::NodeCPtr root
+ DefinitionManager const& definition_manager, ProvinceHistoryEntry& entry, ast::NodeCPtr root
) {
- BuildingTypeManager const& building_type_manager = game_manager.get_economy_manager().get_building_type_manager();
- CountryManager const& country_manager = game_manager.get_country_manager();
- GoodDefinitionManager const& good_definition_manager = game_manager.get_economy_manager().get_good_definition_manager();
- IdeologyManager const& ideology_manager = game_manager.get_politics_manager().get_ideology_manager();
- TerrainTypeManager const& terrain_type_manager = game_manager.get_map_definition().get_terrain_type_manager();
+ BuildingTypeManager const& building_type_manager = definition_manager.get_economy_manager().get_building_type_manager();
+ CountryManager const& country_manager = definition_manager.get_country_manager();
+ GoodDefinitionManager const& good_definition_manager =
+ definition_manager.get_economy_manager().get_good_definition_manager();
+ IdeologyManager const& ideology_manager = definition_manager.get_politics_manager().get_ideology_manager();
+ TerrainTypeManager const& terrain_type_manager = definition_manager.get_map_definition().get_terrain_type_manager();
using enum ProvinceInstance::colony_status_t;
static const string_map_t<ProvinceInstance::colony_status_t> colony_status_map {
@@ -30,7 +31,7 @@ bool ProvinceHistoryMap::_load_history_entry(
};
return expect_dictionary_keys_and_default(
- [this, &game_manager, &building_type_manager, &entry](
+ [this, &definition_manager, &building_type_manager, &entry](
std::string_view key, ast::NodeCPtr value) -> bool {
// used for province buildings like forts or railroads
BuildingType const* building_type = building_type_manager.get_building_type_by_identifier(key);
@@ -50,7 +51,7 @@ bool ProvinceHistoryMap::_load_history_entry(
}
}
- return _load_history_sub_entry_callback(game_manager, entry.get_date(), value, key, value);
+ return _load_history_sub_entry_callback(definition_manager, entry.get_date(), value, key, value);
},
"owner", ZERO_OR_ONE,
country_manager.expect_country_identifier(assign_variable_callback_pointer_opt(entry.owner, true)),
@@ -183,7 +184,7 @@ ProvinceHistoryMap* ProvinceHistoryManager::_get_or_make_province_history(Provin
}
bool ProvinceHistoryManager::load_province_history_file(
- GameManager const& game_manager, ProvinceDefinition const& province, ast::NodeCPtr root
+ DefinitionManager const& definition_manager, ProvinceDefinition const& province, ast::NodeCPtr root
) {
if (locked) {
Logger::error(
@@ -195,17 +196,17 @@ bool ProvinceHistoryManager::load_province_history_file(
ProvinceHistoryMap* province_history = _get_or_make_province_history(province);
if (province_history != nullptr) {
- return province_history->_load_history_file(game_manager, root);
+ return province_history->_load_history_file(definition_manager, root);
} else {
return false;
}
}
bool ProvinceHistoryEntry::_load_province_pop_history(
- GameManager const& game_manager, ast::NodeCPtr root, bool *non_integer_size
+ DefinitionManager const& definition_manager, ast::NodeCPtr root, bool *non_integer_size
) {
- PopManager const& pop_manager = game_manager.get_pop_manager();
- RebelManager const& rebel_manager = game_manager.get_politics_manager().get_rebel_manager();
+ PopManager const& pop_manager = definition_manager.get_pop_manager();
+ RebelManager const& rebel_manager = definition_manager.get_politics_manager().get_rebel_manager();
return pop_manager.expect_pop_type_dictionary_reserve_length(
pops,
[this, &pop_manager, &rebel_manager, non_integer_size](PopType const& pop_type, ast::NodeCPtr pop_node) -> bool {
@@ -215,28 +216,28 @@ bool ProvinceHistoryEntry::_load_province_pop_history(
}
bool ProvinceHistoryMap::_load_province_pop_history(
- GameManager const& game_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
+ DefinitionManager const& definition_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
) {
- ProvinceHistoryEntry* entry = _get_or_make_entry(game_manager, date);
+ ProvinceHistoryEntry* entry = _get_or_make_entry(definition_manager, date);
if (entry != nullptr) {
- return entry->_load_province_pop_history(game_manager, root, non_integer_size);
+ return entry->_load_province_pop_history(definition_manager, root, non_integer_size);
} else {
return false;
}
}
bool ProvinceHistoryManager::load_pop_history_file(
- GameManager const& game_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
+ DefinitionManager const& definition_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
) {
if (locked) {
Logger::error("Attempted to load pop history file after province history registry was locked!");
return false;
}
- return game_manager.get_map_definition().expect_province_definition_dictionary(
- [this, &game_manager, date, non_integer_size](ProvinceDefinition const& province, ast::NodeCPtr node) -> bool {
+ return definition_manager.get_map_definition().expect_province_definition_dictionary(
+ [this, &definition_manager, date, non_integer_size](ProvinceDefinition const& province, ast::NodeCPtr node) -> bool {
ProvinceHistoryMap* province_history = _get_or_make_province_history(province);
if (province_history != nullptr) {
- return province_history->_load_province_pop_history(game_manager, date, node, non_integer_size);
+ return province_history->_load_province_pop_history(definition_manager, date, node, non_integer_size);
} else {
return false;
}
diff --git a/src/openvic-simulation/history/ProvinceHistory.hpp b/src/openvic-simulation/history/ProvinceHistory.hpp
index 015b7be..7c283f4 100644
--- a/src/openvic-simulation/history/ProvinceHistory.hpp
+++ b/src/openvic-simulation/history/ProvinceHistory.hpp
@@ -19,7 +19,7 @@ namespace OpenVic {
struct GoodDefinition;
struct TerrainType;
struct Ideology;
- struct GameManager;
+ struct DefinitionManager;
struct ProvinceHistoryEntry : HistoryEntry {
friend struct ProvinceHistoryMap;
@@ -45,7 +45,9 @@ namespace OpenVic {
ProvinceHistoryEntry(ProvinceDefinition const& new_province, Date new_date);
- bool _load_province_pop_history(GameManager const& game_manager, ast::NodeCPtr root, bool *non_integer_size);
+ bool _load_province_pop_history(
+ DefinitionManager const& definition_manager, ast::NodeCPtr root, bool *non_integer_size
+ );
};
struct ProvinceHistoryManager;
@@ -60,11 +62,13 @@ namespace OpenVic {
ProvinceHistoryMap(ProvinceDefinition const& new_province);
std::unique_ptr<ProvinceHistoryEntry> _make_entry(Date date) const override;
- bool _load_history_entry(GameManager const& game_manager, ProvinceHistoryEntry& entry, ast::NodeCPtr root) override;
+ bool _load_history_entry(
+ DefinitionManager const& definition_manager, ProvinceHistoryEntry& entry, ast::NodeCPtr root
+ ) override;
private:
bool _load_province_pop_history(
- GameManager const& game_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
+ DefinitionManager const& definition_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
);
};
@@ -87,8 +91,10 @@ namespace OpenVic {
ProvinceHistoryMap const* get_province_history(ProvinceDefinition const* province) const;
bool load_province_history_file(
- GameManager const& game_manager, ProvinceDefinition const& province, ast::NodeCPtr root
+ DefinitionManager const& definition_manager, ProvinceDefinition const& province, ast::NodeCPtr root
+ );
+ bool load_pop_history_file(
+ DefinitionManager const& definition_manager, Date date, ast::NodeCPtr root, bool *non_integer_size
);
- bool load_pop_history_file(GameManager const& game_manager, Date date, ast::NodeCPtr root, bool *non_integer_size);
};
}