From 3fcdd0c7fce2de4cbe14a0cc3d6fb4c2731b93d9 Mon Sep 17 00:00:00 2001 From: hop311 Date: Fri, 20 Sep 2024 22:45:19 +0100 Subject: Add modifier type enum --- src/openvic-simulation/research/Invention.cpp | 6 +++++- src/openvic-simulation/research/Technology.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/openvic-simulation/research') diff --git a/src/openvic-simulation/research/Invention.cpp b/src/openvic-simulation/research/Invention.cpp index 5ecfcdc..299cefb 100644 --- a/src/openvic-simulation/research/Invention.cpp +++ b/src/openvic-simulation/research/Invention.cpp @@ -18,7 +18,7 @@ Invention::Invention( bool new_unlock_gas_defence, ConditionScript&& new_limit, ConditionalWeight&& new_chance -) : Modifier { new_identifier, std::move(new_values) }, +) : Modifier { new_identifier, std::move(new_values), modifier_type_t::INVENTION }, news { new_news }, activated_units { std::move(new_activated_units) }, activated_buildings { std::move(new_activated_buildings) }, @@ -30,8 +30,10 @@ Invention::Invention( bool Invention::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; + ret &= limit.parse_script(false, definition_manager); ret &= chance.parse_scripts(definition_manager); + return ret; } @@ -104,8 +106,10 @@ bool InventionManager::load_inventions_file( bool InventionManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; + for (Invention& invention : inventions.get_items()) { ret &= invention.parse_scripts(definition_manager); } + return ret; } diff --git a/src/openvic-simulation/research/Technology.cpp b/src/openvic-simulation/research/Technology.cpp index 847c4b0..a5256f3 100644 --- a/src/openvic-simulation/research/Technology.cpp +++ b/src/openvic-simulation/research/Technology.cpp @@ -19,7 +19,7 @@ Technology::Technology( building_set_t&& new_activated_buildings, ModifierValue&& new_values, ConditionalWeight&& new_ai_chance -) : Modifier { new_identifier, std::move(new_values) }, +) : Modifier { new_identifier, std::move(new_values), modifier_type_t::TECHNOLOGY }, area { new_area }, year { new_year }, cost { new_cost }, @@ -34,7 +34,7 @@ bool Technology::parse_scripts(DefinitionManager const& definition_manager) { } TechnologySchool::TechnologySchool(std::string_view new_identifier, ModifierValue&& new_values) - : Modifier { new_identifier, std::move(new_values) } {} + : Modifier { new_identifier, std::move(new_values), modifier_type_t::TECH_SCHOOL } {} bool TechnologyManager::add_technology_folder(std::string_view identifier) { if (identifier.empty()) { -- cgit v1.2.3-56-ga3b1