From e4701ebc08f57575a02bdc1777d9851a987c1cba Mon Sep 17 00:00:00 2001 From: hop311 Date: Sun, 14 Jul 2024 15:01:25 +0100 Subject: Unit and leader rework (branch based templates and colony containers) --- src/openvic-simulation/military/Leader.hpp | 47 ++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'src/openvic-simulation/military/Leader.hpp') 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 +#include + #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 + struct UnitInstanceGroup; + + template + struct UnitInstanceGroupBranched; + + template + struct LeaderBranched : LeaderBase { + + friend struct CountryInstance; + friend bool UnitInstanceGroup::set_leader(LeaderBranched* new_leader); + + private: + UnitInstanceGroupBranched* PROPERTY(unit_instance_group); + + LeaderBranched(LeaderBase const& leader_base) : LeaderBase { leader_base }, unit_instance_group { nullptr } {} + }; + + using General = LeaderBranched; + using Admiral = LeaderBranched; +} -- cgit v1.2.3-56-ga3b1