diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-10-20 10:42:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 10:42:00 +0200 |
commit | 910d6cd73d7b1857ff481e1af060e780ec27d800 (patch) | |
tree | 3a3c32d8f631fefda101ec3b47147da3bb81e297 /src/openvic-simulation/military/LeaderTrait.hpp | |
parent | 1484dd3aa73489cc66572f1c431e08c610e201af (diff) | |
parent | d2e91829abc8dd46fa4685d1cab89ef6fe907471 (diff) |
Merge pull request #62 from OpenVicProject/cleanup
Diffstat (limited to 'src/openvic-simulation/military/LeaderTrait.hpp')
-rw-r--r-- | src/openvic-simulation/military/LeaderTrait.hpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/src/openvic-simulation/military/LeaderTrait.hpp b/src/openvic-simulation/military/LeaderTrait.hpp index f4445f6..e525e23 100644 --- a/src/openvic-simulation/military/LeaderTrait.hpp +++ b/src/openvic-simulation/military/LeaderTrait.hpp @@ -8,65 +8,65 @@ #include "openvic-simulation/Modifier.hpp" namespace OpenVic { - struct LeaderTraitManager; + struct LeaderTraitManager; - enum class trait_type_t { - PERSONALITY, - BACKGROUND - }; + struct LeaderTrait : HasIdentifier { + friend struct LeaderTraitManager; - struct LeaderTrait : HasIdentifier { - friend struct LeaderTraitManager; + enum class trait_type_t { + PERSONALITY, + BACKGROUND + }; - private: + private: - const trait_type_t type; - /* - * Allowed modifiers for leaders: - * attack - integer - * defence - integer - * morale - % - * organisation - % - * reconnaissance - % - * speed - % - * attrition - %, negative is good - * experience - % - * reliability - decimal, mil gain or loss for associated POPs - */ - const ModifierValue modifiers; + const trait_type_t type; + /* + * Allowed modifiers for leaders: + * attack - integer + * defence - integer + * morale - % + * organisation - % + * reconnaissance - % + * speed - % + * attrition - %, negative is good + * experience - % + * reliability - decimal, mil gain or loss for associated POPs + */ + const ModifierValue modifiers; - LeaderTrait(std::string_view new_identifier, trait_type_t new_type, ModifierValue new_modifiers); - - public: - LeaderTrait(LeaderTrait&&) = default; + LeaderTrait(std::string_view new_identifier, trait_type_t new_type, ModifierValue&& new_modifiers); - trait_type_t get_trait_type() const; - bool is_personality_trait() const; - bool is_background_trait() const; - ModifierValue get_modifiers() const; - }; + public: + LeaderTrait(LeaderTrait&&) = default; - struct LeaderTraitManager { - private: - IdentifierRegistry<LeaderTrait> leader_traits; - const std::set<std::string, std::less<void>> allowed_modifiers = { - "attack", - "defence", - "morale", - "organisation", - "reconnaissance", - "speed", - "attrition", - "experience", - "reliability" - }; - - public: - LeaderTraitManager(); + trait_type_t get_trait_type() const; + bool is_personality_trait() const; + bool is_background_trait() const; + ModifierValue const& get_modifiers() const; + }; - bool add_leader_trait(std::string_view identifier, trait_type_t type, ModifierValue modifiers); - IDENTIFIER_REGISTRY_ACCESSORS(leader_trait) + struct LeaderTraitManager { + private: + IdentifierRegistry<LeaderTrait> leader_traits; + inline static const string_set_t allowed_modifiers = { + "attack", + "defence", + "morale", + "organisation", + "reconnaissance", + "speed", + "attrition", + "experience", + "reliability" + }; - bool load_leader_traits_file(ModifierManager& modifier_manager, ast::NodeCPtr root); - }; + 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); + }; } // namespace OpenVic |