From 4b39e77304094708d5c503b6a221386408cc4409 Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 12 Jun 2024 23:24:00 +0100 Subject: Separated GameManager into Definition and Instance Managers --- src/openvic-simulation/politics/Ideology.cpp | 18 +++++++++--------- src/openvic-simulation/politics/Ideology.hpp | 4 ++-- src/openvic-simulation/politics/Issue.cpp | 12 ++++++------ src/openvic-simulation/politics/Issue.hpp | 4 ++-- src/openvic-simulation/politics/NationalFocus.cpp | 8 ++++---- src/openvic-simulation/politics/NationalFocus.hpp | 6 +++--- src/openvic-simulation/politics/Rebel.cpp | 20 ++++++++++---------- src/openvic-simulation/politics/Rebel.hpp | 4 ++-- 8 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/openvic-simulation/politics') diff --git a/src/openvic-simulation/politics/Ideology.cpp b/src/openvic-simulation/politics/Ideology.cpp index 1848a0a..546d16e 100644 --- a/src/openvic-simulation/politics/Ideology.cpp +++ b/src/openvic-simulation/politics/Ideology.cpp @@ -20,14 +20,14 @@ Ideology::Ideology( add_social_reform { std::move(new_add_social_reform) }, remove_social_reform { std::move(new_remove_social_reform) }, add_military_reform { std::move(new_add_military_reform) }, add_economic_reform { std::move(new_add_economic_reform) } {} -bool Ideology::parse_scripts(GameManager const& game_manager) { +bool Ideology::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; - ret &= add_political_reform.parse_scripts(game_manager); - ret &= remove_political_reform.parse_scripts(game_manager); - ret &= add_social_reform.parse_scripts(game_manager); - ret &= remove_social_reform.parse_scripts(game_manager); - ret &= add_military_reform.parse_scripts(game_manager); - ret &= add_economic_reform.parse_scripts(game_manager); + ret &= add_political_reform.parse_scripts(definition_manager); + ret &= remove_political_reform.parse_scripts(definition_manager); + ret &= add_social_reform.parse_scripts(definition_manager); + ret &= remove_social_reform.parse_scripts(definition_manager); + ret &= add_military_reform.parse_scripts(definition_manager); + ret &= add_economic_reform.parse_scripts(definition_manager); return ret; } @@ -118,10 +118,10 @@ bool IdeologyManager::load_ideology_file(ast::NodeCPtr root) { return ret; } -bool IdeologyManager::parse_scripts(GameManager const& game_manager) { +bool IdeologyManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (Ideology& ideology : ideologies.get_items()) { - ideology.parse_scripts(game_manager); + ideology.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/politics/Ideology.hpp b/src/openvic-simulation/politics/Ideology.hpp index ad07f06..da3effc 100644 --- a/src/openvic-simulation/politics/Ideology.hpp +++ b/src/openvic-simulation/politics/Ideology.hpp @@ -41,7 +41,7 @@ namespace OpenVic { ConditionalWeight&& new_add_economic_reform ); - bool parse_scripts(GameManager const& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: Ideology(Ideology&&) = default; @@ -65,6 +65,6 @@ namespace OpenVic { bool load_ideology_file(ast::NodeCPtr root); - bool parse_scripts(GameManager const& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); }; } diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp index 8e0907a..a03ffa3 100644 --- a/src/openvic-simulation/politics/Issue.cpp +++ b/src/openvic-simulation/politics/Issue.cpp @@ -25,11 +25,11 @@ Reform::Reform( reform_group { new_group }, technology_cost { new_technology_cost }, allow { std::move(new_allow) }, on_execute_trigger { std::move(new_on_execute_trigger) }, on_execute_effect { std::move(new_on_execute_effect) } {} -bool Reform::parse_scripts(GameManager& game_manager) { +bool Reform::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; - ret &= allow.parse_script(true, game_manager); - ret &= on_execute_trigger.parse_script(true, game_manager); - ret &= on_execute_effect.parse_script(true, game_manager); + ret &= allow.parse_script(true, definition_manager); + ret &= on_execute_trigger.parse_script(true, definition_manager); + ret &= on_execute_effect.parse_script(true, definition_manager); return ret; } @@ -350,10 +350,10 @@ bool IssueManager::load_issues_file( return ret; } -bool IssueManager::parse_scripts(GameManager& game_manager) { +bool IssueManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (Reform& reform : reforms.get_items()) { - ret &= reform.parse_scripts(game_manager); + ret &= reform.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/politics/Issue.hpp b/src/openvic-simulation/politics/Issue.hpp index 68302bd..25fa72e 100644 --- a/src/openvic-simulation/politics/Issue.hpp +++ b/src/openvic-simulation/politics/Issue.hpp @@ -87,7 +87,7 @@ namespace OpenVic { ConditionScript&& new_on_execute_trigger, EffectScript&& new_on_execute_effect ); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: Reform(Reform&&) = default; @@ -130,6 +130,6 @@ namespace OpenVic { ); bool load_issues_file(ModifierManager const& modifier_manager, RuleManager const& rule_manager, ast::NodeCPtr root); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); }; } diff --git a/src/openvic-simulation/politics/NationalFocus.cpp b/src/openvic-simulation/politics/NationalFocus.cpp index a62147f..85fcdc0 100644 --- a/src/openvic-simulation/politics/NationalFocus.cpp +++ b/src/openvic-simulation/politics/NationalFocus.cpp @@ -27,8 +27,8 @@ NationalFocus::NationalFocus( loyalty_value { new_loyalty_value }, limit { std::move(new_limit) } {} -bool NationalFocus::parse_scripts(GameManager const& game_manager) { - return limit.parse_script(true, game_manager); +bool NationalFocus::parse_scripts(DefinitionManager const& definition_manager) { + return limit.parse_script(true, definition_manager); } inline bool NationalFocusManager::add_national_focus_group(std::string_view identifier) { @@ -131,10 +131,10 @@ bool NationalFocusManager::load_national_foci_file( return ret; } -bool NationalFocusManager::parse_scripts(GameManager const& game_manager) { +bool NationalFocusManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (NationalFocus& national_focus : national_foci.get_items()) { - ret &= national_focus.parse_scripts(game_manager); + ret &= national_focus.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/politics/NationalFocus.hpp b/src/openvic-simulation/politics/NationalFocus.hpp index d8c5611..f27af43 100644 --- a/src/openvic-simulation/politics/NationalFocus.hpp +++ b/src/openvic-simulation/politics/NationalFocus.hpp @@ -45,7 +45,7 @@ namespace OpenVic { ConditionScript&& new_limit ); - bool parse_scripts(GameManager const& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: NationalFocus(NationalFocus&&) = default; @@ -77,6 +77,6 @@ namespace OpenVic { GoodDefinitionManager const& good_definition_manager, ModifierManager const& modifier_manager, ast::NodeCPtr root ); - bool parse_scripts(GameManager const& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); }; -} // namespace OpenVic +} diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp index ce99d08..fcb08c9 100644 --- a/src/openvic-simulation/politics/Rebel.cpp +++ b/src/openvic-simulation/politics/Rebel.cpp @@ -27,15 +27,15 @@ RebelType::RebelType( siege_won_effect { std::move(new_siege_won_effect) }, demands_enforced_trigger { std::move(new_demands_enforced_trigger) }, demands_enforced_effect { std::move(new_demands_enforced_effect) } {} -bool RebelType::parse_scripts(GameManager& game_manager) { +bool RebelType::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; - ret &= will_rise.parse_scripts(game_manager); - ret &= spawn_chance.parse_scripts(game_manager); - ret &= movement_evaluation.parse_scripts(game_manager); - ret &= siege_won_trigger.parse_script(true, game_manager); - ret &= siege_won_effect.parse_script(true, game_manager); - ret &= demands_enforced_trigger.parse_script(true, game_manager); - ret &= demands_enforced_effect.parse_script(true, game_manager); + ret &= will_rise.parse_scripts(definition_manager); + ret &= spawn_chance.parse_scripts(definition_manager); + ret &= movement_evaluation.parse_scripts(definition_manager); + ret &= siege_won_trigger.parse_script(true, definition_manager); + ret &= siege_won_effect.parse_script(true, definition_manager); + ret &= demands_enforced_trigger.parse_script(true, definition_manager); + ret &= demands_enforced_effect.parse_script(true, definition_manager); return ret; } @@ -191,10 +191,10 @@ bool RebelManager::generate_modifiers(ModifierManager& modifier_manager) const { return ret; } -bool RebelManager::parse_scripts(GameManager& game_manager) { +bool RebelManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (RebelType& rebel_type : rebel_types.get_items()) { - ret &= rebel_type.parse_scripts(game_manager); + ret &= rebel_type.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/politics/Rebel.hpp b/src/openvic-simulation/politics/Rebel.hpp index f098fe0..7aeb31b 100644 --- a/src/openvic-simulation/politics/Rebel.hpp +++ b/src/openvic-simulation/politics/Rebel.hpp @@ -73,7 +73,7 @@ namespace OpenVic { EffectScript&& new_demands_enforced_effect ); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: RebelType(RebelType&&) = default; @@ -98,6 +98,6 @@ namespace OpenVic { bool load_rebels_file(IdeologyManager const& ideology_manager, GovernmentTypeManager const& government_type_manager, ast::NodeCPtr root); bool generate_modifiers(ModifierManager& modifier_manager) const; - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); }; } \ No newline at end of file -- cgit v1.2.3-56-ga3b1