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/scripts/ConditionalWeight.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/openvic-simulation/scripts/ConditionalWeight.cpp') diff --git a/src/openvic-simulation/scripts/ConditionalWeight.cpp b/src/openvic-simulation/scripts/ConditionalWeight.cpp index e5bb7d0..7c3e0a0 100644 --- a/src/openvic-simulation/scripts/ConditionalWeight.cpp +++ b/src/openvic-simulation/scripts/ConditionalWeight.cpp @@ -7,7 +7,9 @@ ConditionalWeight::ConditionalWeight(scope_t new_initial_scope, scope_t new_this : initial_scope { new_initial_scope }, this_scope { new_this_scope }, from_scope { new_from_scope } {} template -static NodeCallback auto expect_modifier(std::vector& items, scope_t initial_scope, scope_t this_scope, scope_t from_scope) { +static NodeCallback auto expect_modifier( + std::vector& items, scope_t initial_scope, scope_t this_scope, scope_t from_scope +) { return [&items, initial_scope, this_scope, from_scope](ast::NodeCPtr node) -> bool { fixed_point_t weight = 0; bool successful = false; @@ -46,10 +48,10 @@ node_callback_t ConditionalWeight::expect_conditional_weight(base_key_t base_key } struct ConditionalWeight::parse_scripts_visitor_t { - GameManager const& game_manager; + DefinitionManager const& definition_manager; bool operator()(condition_weight_t& condition_weight) const { - return condition_weight.second.parse_script(false, game_manager); + return condition_weight.second.parse_script(false, definition_manager); } bool operator()(condition_weight_item_t& item) const { return std::visit(*this, item); @@ -64,6 +66,6 @@ struct ConditionalWeight::parse_scripts_visitor_t { } }; -bool ConditionalWeight::parse_scripts(GameManager const& game_manager) { - return parse_scripts_visitor_t { game_manager }(condition_weight_items); +bool ConditionalWeight::parse_scripts(DefinitionManager const& definition_manager) { + return parse_scripts_visitor_t { definition_manager }(condition_weight_items); } -- cgit v1.2.3-56-ga3b1