From 5f64f983d0cead266a28791be42162c443fd2a75 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sun, 31 Dec 2023 00:47:31 +0000 Subject: Added framework for loading all Conditions and Effects --- src/openvic-simulation/research/Technology.hpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/openvic-simulation/research/Technology.hpp') diff --git a/src/openvic-simulation/research/Technology.hpp b/src/openvic-simulation/research/Technology.hpp index 3b0b1da..a4287a5 100644 --- a/src/openvic-simulation/research/Technology.hpp +++ b/src/openvic-simulation/research/Technology.hpp @@ -5,6 +5,7 @@ #include "openvic-simulation/economy/BuildingType.hpp" #include "openvic-simulation/military/Unit.hpp" #include "openvic-simulation/misc/Modifier.hpp" +#include "openvic-simulation/scripts/ConditionalWeight.hpp" #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/OrderedContainers.hpp" @@ -43,17 +44,18 @@ namespace OpenVic { const fixed_point_t PROPERTY(cost); const bool PROPERTY(unciv_military); const uint8_t PROPERTY(unit); - const unit_set_t PROPERTY(activated_buildings); - const building_set_t PROPERTY(activated_units); - - //TODO: implement rules/modifiers and ai_chance + unit_set_t PROPERTY(activated_buildings); + building_set_t PROPERTY(activated_units); + ConditionalWeight PROPERTY(ai_chance); Technology( std::string_view new_identifier, TechnologyArea const& new_area, Date::year_t new_year, fixed_point_t new_cost, bool new_unciv_military, uint8_t new_unit, unit_set_t&& new_activated_units, - building_set_t&& new_activated_buildings, ModifierValue&& new_values + building_set_t&& new_activated_buildings, ModifierValue&& new_values, ConditionalWeight&& new_ai_chance ); + bool parse_scripts(GameManager const& game_manager); + public: Technology(Technology&&) = default; }; @@ -79,7 +81,8 @@ namespace OpenVic { bool add_technology( std::string_view identifier, TechnologyArea const* area, Date::year_t year, fixed_point_t cost, bool unciv_military, uint8_t unit, Technology::unit_set_t&& activated_units, - Technology::building_set_t&& activated_buildings, ModifierValue&& values); + Technology::building_set_t&& activated_buildings, ModifierValue&& values, ConditionalWeight&& ai_chance + ); bool add_technology_school(std::string_view identifier, ModifierValue&& values); @@ -90,5 +93,7 @@ namespace OpenVic { BuildingTypeManager const& building_type_manager, ast::NodeCPtr root ); // technologies/*.txt bool generate_modifiers(ModifierManager& modifier_manager) const; + + bool parse_scripts(GameManager const& game_manager); }; } \ No newline at end of file -- cgit v1.2.3-56-ga3b1