diff options
author | Hop311 <Hop3114@gmail.com> | 2024-07-19 21:35:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-19 21:35:22 +0200 |
commit | e0518bee9b4c164f40716a8033b5e207c2060c0b (patch) | |
tree | 6d2de5221d2b1945a065e0abba8198d8a052a92a /src/openvic-simulation/country/CountryInstance.hpp | |
parent | a673f89bb2705826b1c646365eab1775727372b7 (diff) | |
parent | d8baf57d46539da9edba5952f73089bf9a54bdaf (diff) |
Merge pull request #175 from OpenVicProject/unit-work
Unit position/country/leader handling + more use of unit branch templates
Diffstat (limited to 'src/openvic-simulation/country/CountryInstance.hpp')
-rw-r--r-- | src/openvic-simulation/country/CountryInstance.hpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/openvic-simulation/country/CountryInstance.hpp b/src/openvic-simulation/country/CountryInstance.hpp index 885a5fd..1eaf398 100644 --- a/src/openvic-simulation/country/CountryInstance.hpp +++ b/src/openvic-simulation/country/CountryInstance.hpp @@ -54,6 +54,11 @@ namespace OpenVic { plf::colony<General> PROPERTY(generals); plf::colony<Admiral> PROPERTY(admirals); + ordered_set<ArmyInstance*> PROPERTY(armies); + ordered_set<NavyInstance*> PROPERTY(navies); + + UNIT_BRANCHED_GETTER(get_unit_instance_groups, armies, navies); + UNIT_BRANCHED_GETTER(get_leaders, generals, admirals); CountryInstance( CountryDefinition const* new_country_definition, decltype(technologies)::keys_t const& technology_keys, @@ -70,13 +75,15 @@ namespace OpenVic { bool add_reform(Reform const* new_reform); bool remove_reform(Reform const* reform_to_remove); - void add_general(General&& new_general); - bool remove_general(General const* general_to_remove); - void add_admiral(Admiral&& new_admiral); - bool remove_admiral(Admiral const* admiral_to_remove); + template<UnitType::branch_t Branch> + bool add_unit_instance_group(UnitInstanceGroup<Branch>& group); + template<UnitType::branch_t Branch> + bool remove_unit_instance_group(UnitInstanceGroup<Branch>& group); - bool add_leader(LeaderBase const& new_leader); - bool remove_leader(LeaderBase const* leader_to_remove); + template<UnitType::branch_t Branch> + void add_leader(LeaderBranched<Branch>&& leader); + template<UnitType::branch_t Branch> + bool remove_leader(LeaderBranched<Branch> const* leader); bool apply_history_to_country(CountryHistoryEntry const* entry); }; |