diff options
author | zaaarf <zaaarf@proton.me> | 2023-11-30 21:20:37 +0100 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-12-02 01:12:12 +0100 |
commit | c935e471782764dcc10a3175741a02ab3ffffa8e (patch) | |
tree | 49016457c09ef3583b200a8bd016dc702b6e298e /src/openvic-simulation/tech/Technology.hpp | |
parent | 51583b66feb1d13b285bb2e9c05364659c854130 (diff) |
feat: implemented modifier identifier flattening, added/fixed remaining tech modifiers effects
Diffstat (limited to 'src/openvic-simulation/tech/Technology.hpp')
-rw-r--r-- | src/openvic-simulation/tech/Technology.hpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/openvic-simulation/tech/Technology.hpp b/src/openvic-simulation/tech/Technology.hpp index e6ce2fa..0aca1f6 100644 --- a/src/openvic-simulation/tech/Technology.hpp +++ b/src/openvic-simulation/tech/Technology.hpp @@ -1,9 +1,10 @@ #pragma once -#include "misc/Modifier.hpp" -#include "types/Date.hpp" -#include "types/IdentifierRegistry.hpp" -#include "types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/misc/Modifier.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/military/Unit.hpp" +#include "openvic-simulation/economy/BuildingType.hpp" +#include <cstdint> namespace OpenVic { struct TechnologyFolder : HasIdentifier { @@ -31,16 +32,21 @@ namespace OpenVic { struct Technology : Modifier { friend struct TechnologyManager; using year_t = Date::year_t; + using unit_set_t = std::unordered_set<Unit const*>; + using building_set_t = std::unordered_set<BuildingType const*>; private: TechnologyArea const& PROPERTY(area); const year_t PROPERTY(year); 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 - Technology(std::string_view identifier, TechnologyArea const& area, year_t year, fixed_point_t cost, bool unciv_military, ModifierValue&& values); + Technology(std::string_view identifier, TechnologyArea const& area, year_t year, fixed_point_t cost, bool unciv_military, uint8_t unit, unit_set_t activated_units, building_set_t activated_buildings, ModifierValue&& values); public: Technology(Technology&&) = default; @@ -68,13 +74,15 @@ namespace OpenVic { bool add_technology_area(std::string_view identifier, TechnologyFolder const* folder); IDENTIFIER_REGISTRY_ACCESSORS(technology_area) - bool add_technology(std::string_view identifier, TechnologyArea const* area, Technology::year_t year, fixed_point_t cost, bool unciv_military, ModifierValue&& values); + bool add_technology(std::string_view identifier, TechnologyArea const* area, Technology::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); IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(technology, technologies) bool add_technology_school(std::string_view identifier, ModifierValue&& values); //, Modifier::icon_t icon); IDENTIFIER_REGISTRY_ACCESSORS(technology_school); - bool load_technology_file(ModifierManager const& modifier_manager, ast::NodeCPtr root); // common/technology.txt - bool load_technologies_file(ModifierManager const& modifier_manager, ast::NodeCPtr root); // technologies/*.txt + bool load_technology_file_areas(ast::NodeCPtr root); // common/technology.txt + bool load_technology_file_schools(ModifierManager const& modifier_manager, ast::NodeCPtr root); // also common/technology.txt + bool load_technologies_file(ModifierManager const& modifier_manager, UnitManager const& unit_manager, BuildingManager const& building_manager, ast::NodeCPtr root); // technologies/*.txt + bool generate_modifiers(ModifierManager& modifier_manager); }; }
\ No newline at end of file |