aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/Leader.hpp
blob: 3f8603ef10e69c9a05c12f1006f9346d7919ef44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#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 DeploymentManager;

   struct LeaderBase {
      friend struct DeploymentManager;

   private:
      std::string        PROPERTY(name);
      UnitType::branch_t PROPERTY(branch); /* type in defines */
      Date               PROPERTY(date);
      LeaderTrait const* PROPERTY(personality);
      LeaderTrait const* PROPERTY(background);
      fixed_point_t      PROPERTY(prestige);
      std::string        PROPERTY(picture);

   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
      );

   protected:
      LeaderBase(LeaderBase const&) = default;

   public:
      LeaderBase(LeaderBase&&) = default;
   };

   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>;
}