diff options
author | Hop311 <Hop3114@gmail.com> | 2024-07-14 17:37:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-14 17:37:10 +0200 |
commit | e8a3b33f13ebdf3a388b4996308b4db9763dc375 (patch) | |
tree | db365e5d71df41b7b35abdcc3d4c0d76f1653619 /src/openvic-simulation/military/Leader.hpp | |
parent | b9b35ad9536cfdcd61f5208eeaad7ead4bd0418d (diff) | |
parent | e4701ebc08f57575a02bdc1777d9851a987c1cba (diff) |
Merge pull request #173 from OpenVicProject/unit-colonies
Unit and leader rework (branch based templates and colony containers)
Diffstat (limited to 'src/openvic-simulation/military/Leader.hpp')
-rw-r--r-- | src/openvic-simulation/military/Leader.hpp | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/src/openvic-simulation/military/Leader.hpp b/src/openvic-simulation/military/Leader.hpp index 5995164..3f8603e 100644 --- a/src/openvic-simulation/military/Leader.hpp +++ b/src/openvic-simulation/military/Leader.hpp @@ -1,10 +1,20 @@ #pragma once +#include <string> +#include <string_view> + #include "openvic-simulation/military/LeaderTrait.hpp" #include "openvic-simulation/military/UnitType.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Utility.hpp" namespace OpenVic { - struct Leader { + struct DeploymentManager; + + struct LeaderBase { + friend struct DeploymentManager; + private: std::string PROPERTY(name); UnitType::branch_t PROPERTY(branch); /* type in defines */ @@ -14,12 +24,39 @@ namespace OpenVic { fixed_point_t PROPERTY(prestige); std::string PROPERTY(picture); - public: - Leader( + private: + LeaderBase( std::string_view new_name, UnitType::branch_t new_branch, Date new_date, LeaderTrait const* new_personality, LeaderTrait const* new_background, fixed_point_t new_prestige, std::string_view new_picture ); - Leader(Leader&&) = default; + protected: + LeaderBase(LeaderBase const&) = default; + + public: + LeaderBase(LeaderBase&&) = default; }; -}
\ No newline at end of file + + struct CountryInstance; + + template<UnitType::branch_t> + struct UnitInstanceGroup; + + template<UnitType::branch_t> + struct UnitInstanceGroupBranched; + + template<UnitType::branch_t Branch> + struct LeaderBranched : LeaderBase { + + friend struct CountryInstance; + friend bool UnitInstanceGroup<Branch>::set_leader(LeaderBranched<Branch>* new_leader); + + private: + UnitInstanceGroupBranched<Branch>* PROPERTY(unit_instance_group); + + LeaderBranched(LeaderBase const& leader_base) : LeaderBase { leader_base }, unit_instance_group { nullptr } {} + }; + + using General = LeaderBranched<UnitType::branch_t::LAND>; + using Admiral = LeaderBranched<UnitType::branch_t::NAVAL>; +} |