diff options
author | Hop311 <Hop3114@gmail.com> | 2024-06-13 18:59:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-13 18:59:47 +0200 |
commit | bfd539513af435564daf70f94f6cce146dd5c948 (patch) | |
tree | 7ba5a06714c267185dd3a59aabc6556a105c122f /src/openvic-simulation/misc | |
parent | 01a8f60aaca9784d814f4cb35a3fc4be86e1dd20 (diff) | |
parent | 4b39e77304094708d5c503b6a221386408cc4409 (diff) |
Merge pull request #165 from OpenVicProject/instance-definition-managers
Separated GameManager into Definition and Instance Managers
Diffstat (limited to 'src/openvic-simulation/misc')
-rw-r--r-- | src/openvic-simulation/misc/Decision.cpp | 14 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Decision.hpp | 4 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Event.cpp | 20 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Event.hpp | 8 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Modifier.cpp | 8 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Modifier.hpp | 4 |
6 files changed, 29 insertions, 29 deletions
diff --git a/src/openvic-simulation/misc/Decision.cpp b/src/openvic-simulation/misc/Decision.cpp index e0bd7c0..41d4f81 100644 --- a/src/openvic-simulation/misc/Decision.cpp +++ b/src/openvic-simulation/misc/Decision.cpp @@ -13,12 +13,12 @@ Decision::Decision( news_desc_short { new_news_desc_short }, picture { new_picture }, potential { std::move(new_potential) }, allow { std::move(new_allow) }, ai_will_do { std::move(new_ai_will_do) }, effect { std::move(new_effect) } {} -bool Decision::parse_scripts(GameManager& game_manager) { +bool Decision::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; - ret &= potential.parse_script(false, game_manager); - ret &= allow.parse_script(false, game_manager); - ret &= ai_will_do.parse_scripts(game_manager); - ret &= effect.parse_script(false, game_manager); + ret &= potential.parse_script(false, definition_manager); + ret &= allow.parse_script(false, definition_manager); + ret &= ai_will_do.parse_scripts(definition_manager); + ret &= effect.parse_script(false, definition_manager); return ret; } @@ -84,10 +84,10 @@ bool DecisionManager::load_decision_file(ast::NodeCPtr root) { )(root); } -bool DecisionManager::parse_scripts(GameManager& game_manager) { +bool DecisionManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (Decision& decision : decisions.get_items()) { - ret &= decision.parse_scripts(game_manager); + ret &= decision.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/misc/Decision.hpp b/src/openvic-simulation/misc/Decision.hpp index 593b6e4..368dbb0 100644 --- a/src/openvic-simulation/misc/Decision.hpp +++ b/src/openvic-simulation/misc/Decision.hpp @@ -30,7 +30,7 @@ namespace OpenVic { ConditionalWeight&& new_ai_will_do, EffectScript&& new_effect ); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: Decision(Decision&&) = default; @@ -49,6 +49,6 @@ namespace OpenVic { bool load_decision_file(ast::NodeCPtr root); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); }; } diff --git a/src/openvic-simulation/misc/Event.cpp b/src/openvic-simulation/misc/Event.cpp index 2617927..5bfc929 100644 --- a/src/openvic-simulation/misc/Event.cpp +++ b/src/openvic-simulation/misc/Event.cpp @@ -9,10 +9,10 @@ using namespace OpenVic::NodeTools; Event::EventOption::EventOption(std::string_view new_name, EffectScript&& new_effect, ConditionalWeight&& new_ai_chance) : name { new_name }, effect { std::move(new_effect) }, ai_chance { std::move(new_ai_chance) } {} -bool Event::EventOption::parse_scripts(GameManager& game_manager) { +bool Event::EventOption::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; - ret &= effect.parse_script(false, game_manager); - ret &= ai_chance.parse_scripts(game_manager); + ret &= effect.parse_script(false, definition_manager); + ret &= ai_chance.parse_scripts(definition_manager); return ret; } @@ -31,13 +31,13 @@ Event::Event( mean_time_to_happen { std::move(new_mean_time_to_happen) }, immediate { std::move(new_immediate) }, options { std::move(new_options) } {} -bool Event::parse_scripts(GameManager& game_manager) { +bool Event::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; - ret &= trigger.parse_script(true, game_manager); - ret &= mean_time_to_happen.parse_scripts(game_manager); - ret &= immediate.parse_script(true, game_manager); + ret &= trigger.parse_script(true, definition_manager); + ret &= mean_time_to_happen.parse_scripts(definition_manager); + ret &= immediate.parse_script(true, definition_manager); for (EventOption& option : options) { - ret &= option.parse_scripts(game_manager); + ret &= option.parse_scripts(definition_manager); } return ret; } @@ -229,10 +229,10 @@ bool EventManager::load_on_action_file(ast::NodeCPtr root) { return ret; } -bool EventManager::parse_scripts(GameManager& game_manager) { +bool EventManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (Event& event : events.get_items()) { - ret &= event.parse_scripts(game_manager); + ret &= event.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/misc/Event.hpp b/src/openvic-simulation/misc/Event.hpp index 72e96fd..7f80ec8 100644 --- a/src/openvic-simulation/misc/Event.hpp +++ b/src/openvic-simulation/misc/Event.hpp @@ -26,7 +26,7 @@ namespace OpenVic { EventOption(std::string_view new_name, EffectScript&& new_effect, ConditionalWeight&& new_ai_chance); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: EventOption(EventOption const&) = delete; @@ -69,7 +69,7 @@ namespace OpenVic { ConditionalWeight&& new_mean_time_to_happen, EffectScript&& new_immediate, std::vector<EventOption>&& new_options ); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: Event(Event&&) = default; @@ -108,6 +108,6 @@ namespace OpenVic { bool load_event_file(IssueManager const& issue_manager, ast::NodeCPtr root); bool load_on_action_file(ast::NodeCPtr root); - bool parse_scripts(GameManager& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); }; -} // namespace OpenVic +} diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp index 992eb05..d4aaee2 100644 --- a/src/openvic-simulation/misc/Modifier.cpp +++ b/src/openvic-simulation/misc/Modifier.cpp @@ -86,8 +86,8 @@ TriggeredModifier::TriggeredModifier( std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger ) : Modifier { new_identifier, std::move(new_values), new_icon }, trigger { std::move(new_trigger) } {} -bool TriggeredModifier::parse_scripts(GameManager const& game_manager) { - return trigger.parse_script(false, game_manager); +bool TriggeredModifier::parse_scripts(DefinitionManager const& definition_manager) { + return trigger.parse_script(false, definition_manager); } ModifierInstance::ModifierInstance(Modifier const& modifier, Date expiry_date) @@ -356,10 +356,10 @@ bool ModifierManager::load_triggered_modifiers(ast::NodeCPtr root) { return ret; } -bool ModifierManager::parse_scripts(GameManager const& game_manager) { +bool ModifierManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; for (TriggeredModifier& modifier : triggered_modifiers.get_items()) { - ret &= modifier.parse_scripts(game_manager); + ret &= modifier.parse_scripts(definition_manager); } return ret; } diff --git a/src/openvic-simulation/misc/Modifier.hpp b/src/openvic-simulation/misc/Modifier.hpp index abb3891..798b01d 100644 --- a/src/openvic-simulation/misc/Modifier.hpp +++ b/src/openvic-simulation/misc/Modifier.hpp @@ -91,7 +91,7 @@ namespace OpenVic { std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger ); - bool parse_scripts(GameManager const& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); public: TriggeredModifier(TriggeredModifier&&) = default; @@ -151,7 +151,7 @@ namespace OpenVic { ); bool load_triggered_modifiers(ast::NodeCPtr root); - bool parse_scripts(GameManager const& game_manager); + bool parse_scripts(DefinitionManager const& definition_manager); NodeTools::node_callback_t expect_validated_modifier_value_and_default( NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback, |