diff options
author | zaaarf <me@zaaarf.foo> | 2023-12-10 23:15:41 +0100 |
---|---|---|
committer | zaaarf <me@zaaarf.foo> | 2023-12-10 23:15:41 +0100 |
commit | 4ef33d4df6198e613b0f27406d49978c8ea2fb97 (patch) | |
tree | 7f07835485b877f3c01c52c188892499e5812f9b /src/openvic-simulation/military | |
parent | 1eb28bd4fb959b69a30013f6438f0257a2ee7b03 (diff) |
feat: improved identifier registry macro
Diffstat (limited to 'src/openvic-simulation/military')
-rw-r--r-- | src/openvic-simulation/military/Deployment.cpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/military/Deployment.hpp | 5 | ||||
-rw-r--r-- | src/openvic-simulation/military/LeaderTrait.cpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/military/LeaderTrait.hpp | 5 | ||||
-rw-r--r-- | src/openvic-simulation/military/Unit.cpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/military/Unit.hpp | 5 | ||||
-rw-r--r-- | src/openvic-simulation/military/Wargoal.cpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/military/Wargoal.hpp | 5 |
8 files changed, 4 insertions, 24 deletions
diff --git a/src/openvic-simulation/military/Deployment.cpp b/src/openvic-simulation/military/Deployment.cpp index 0530986..da860ad 100644 --- a/src/openvic-simulation/military/Deployment.cpp +++ b/src/openvic-simulation/military/Deployment.cpp @@ -28,8 +28,6 @@ Deployment::Deployment( ) : HasIdentifier { new_path }, armies { std::move(new_armies) }, navies { std::move(new_navies) }, leaders { std::move(new_leaders) } {} -DeploymentManager::DeploymentManager() : deployments { "deployments" } {} - bool DeploymentManager::add_deployment( std::string_view path, std::vector<Army>&& armies, std::vector<Navy>&& navies, std::vector<Leader>&& leaders ) { diff --git a/src/openvic-simulation/military/Deployment.hpp b/src/openvic-simulation/military/Deployment.hpp index 597f727..2aef314 100644 --- a/src/openvic-simulation/military/Deployment.hpp +++ b/src/openvic-simulation/military/Deployment.hpp @@ -90,16 +90,13 @@ namespace OpenVic { struct DeploymentManager { private: - IdentifierInstanceRegistry<Deployment> deployments; + IdentifierInstanceRegistry<Deployment> IDENTIFIER_REGISTRY(deployment); string_set_t missing_oob_files; public: - DeploymentManager(); - bool add_deployment( std::string_view path, std::vector<Army>&& armies, std::vector<Navy>&& navies, std::vector<Leader>&& leaders ); - IDENTIFIER_REGISTRY_ACCESSORS(deployment) bool load_oob_file( GameManager const& game_manager, Dataloader const& dataloader, std::string_view history_path, diff --git a/src/openvic-simulation/military/LeaderTrait.cpp b/src/openvic-simulation/military/LeaderTrait.cpp index 46cd94a..978a3ed 100644 --- a/src/openvic-simulation/military/LeaderTrait.cpp +++ b/src/openvic-simulation/military/LeaderTrait.cpp @@ -14,8 +14,6 @@ bool LeaderTrait::is_background_trait() const { return trait_type == trait_type_t::BACKGROUND; } -LeaderTraitManager::LeaderTraitManager() : leader_traits { "leader trait" } {} - bool LeaderTraitManager::add_leader_trait( std::string_view identifier, LeaderTrait::trait_type_t type, ModifierValue&& modifiers ) { diff --git a/src/openvic-simulation/military/LeaderTrait.hpp b/src/openvic-simulation/military/LeaderTrait.hpp index 4ec3b63..0d84814 100644 --- a/src/openvic-simulation/military/LeaderTrait.hpp +++ b/src/openvic-simulation/military/LeaderTrait.hpp @@ -43,16 +43,13 @@ namespace OpenVic { struct LeaderTraitManager { private: - IdentifierRegistry<LeaderTrait> leader_traits; + IdentifierRegistry<LeaderTrait> IDENTIFIER_REGISTRY(leader_trait); static inline const string_set_t allowed_modifiers = { "attack", "defence", "morale", "organisation", "reconnaissance", "speed", "attrition", "experience", "reliability" }; public: - LeaderTraitManager(); - bool add_leader_trait(std::string_view identifier, LeaderTrait::trait_type_t type, ModifierValue&& modifiers); - IDENTIFIER_REGISTRY_ACCESSORS(leader_trait) bool load_leader_traits_file(ModifierManager const& modifier_manager, ast::NodeCPtr root); }; diff --git a/src/openvic-simulation/military/Unit.cpp b/src/openvic-simulation/military/Unit.cpp index ed3d37b..01c6f84 100644 --- a/src/openvic-simulation/military/Unit.cpp +++ b/src/openvic-simulation/military/Unit.cpp @@ -39,8 +39,6 @@ NavalUnit::NavalUnit( supply_consumption_score { supply_consumption_score }, hull { hull }, gun_power { gun_power }, fire_range { fire_range }, evasion { evasion }, torpedo_attack { torpedo_attack } {}; -UnitManager::UnitManager() : units { "units" } {} - bool UnitManager::_check_shared_parameters(std::string_view identifier, UNIT_PARAMS) { if (identifier.empty()) { Logger::error("Invalid religion identifier - empty!"); diff --git a/src/openvic-simulation/military/Unit.hpp b/src/openvic-simulation/military/Unit.hpp index 17228ce..6e3a6e4 100644 --- a/src/openvic-simulation/military/Unit.hpp +++ b/src/openvic-simulation/military/Unit.hpp @@ -111,16 +111,13 @@ namespace OpenVic { struct UnitManager { private: - IdentifierRegistry<Unit> units; + IdentifierRegistry<Unit> IDENTIFIER_REGISTRY(unit); bool _check_shared_parameters(std::string_view identifier, UNIT_PARAMS); public: - UnitManager(); - bool add_land_unit(std::string_view identifier, UNIT_PARAMS, LAND_PARAMS); bool add_naval_unit(std::string_view identifier, UNIT_PARAMS, NAVY_PARAMS); - IDENTIFIER_REGISTRY_ACCESSORS(unit) static NodeTools::callback_t<std::string_view> expect_type_str(NodeTools::Callback<Unit::type_t> auto callback); diff --git a/src/openvic-simulation/military/Wargoal.cpp b/src/openvic-simulation/military/Wargoal.cpp index 4a00c38..7a12b7e 100644 --- a/src/openvic-simulation/military/Wargoal.cpp +++ b/src/openvic-simulation/military/Wargoal.cpp @@ -33,8 +33,6 @@ WargoalType::WargoalType( modifiers { std::move(new_modifiers) }, peace_options { new_peace_options } {} -WargoalTypeManager::WargoalTypeManager() : wargoal_types { "wargoal types" } {} - const std::vector<WargoalType const*>& WargoalTypeManager::get_peace_priority_list() const { return peace_priorities; } diff --git a/src/openvic-simulation/military/Wargoal.hpp b/src/openvic-simulation/military/Wargoal.hpp index f696511..66fce90 100644 --- a/src/openvic-simulation/military/Wargoal.hpp +++ b/src/openvic-simulation/military/Wargoal.hpp @@ -87,12 +87,10 @@ namespace OpenVic { struct WargoalTypeManager { private: - IdentifierRegistry<WargoalType> wargoal_types; + IdentifierRegistry<WargoalType> IDENTIFIER_REGISTRY(wargoal_type); std::vector<WargoalType const*> PROPERTY(peace_priorities); public: - WargoalTypeManager(); - const std::vector<WargoalType const*>& get_peace_priority_list() const; bool add_wargoal_type( @@ -110,7 +108,6 @@ namespace OpenVic { WargoalType::peace_modifiers_t&& modifiers, peace_options_t peace_options ); - IDENTIFIER_REGISTRY_ACCESSORS(wargoal_type) bool load_wargoal_file(ast::NodeCPtr root); }; |