aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/ProvinceInstance.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-07-19 00:25:38 +0200
committer hop311 <hop3114@gmail.com>2024-07-19 00:26:27 +0200
commitd8baf57d46539da9edba5952f73089bf9a54bdaf (patch)
tree6d2de5221d2b1945a065e0abba8198d8a052a92a /src/openvic-simulation/map/ProvinceInstance.hpp
parenta673f89bb2705826b1c646365eab1775727372b7 (diff)
Unit position/country/leader handling + more use of unit branch templatesunit-work
Diffstat (limited to 'src/openvic-simulation/map/ProvinceInstance.hpp')
-rw-r--r--src/openvic-simulation/map/ProvinceInstance.hpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/openvic-simulation/map/ProvinceInstance.hpp b/src/openvic-simulation/map/ProvinceInstance.hpp
index 4398cd4..ec06e0c 100644
--- a/src/openvic-simulation/map/ProvinceInstance.hpp
+++ b/src/openvic-simulation/map/ProvinceInstance.hpp
@@ -58,6 +58,8 @@ namespace OpenVic {
ordered_set<ArmyInstance*> PROPERTY(armies);
ordered_set<NavyInstance*> PROPERTY(navies);
+ UNIT_BRANCHED_GETTER(get_unit_instance_groups, armies, navies);
+
std::vector<Pop> PROPERTY(pops);
Pop::pop_size_t PROPERTY(total_population);
IndexedMap<PopType, fixed_point_t> PROPERTY(pop_type_distribution);
@@ -89,31 +91,10 @@ namespace OpenVic {
void update_gamestate(Date today);
void tick(Date today);
- bool add_army(ArmyInstance& army);
- bool remove_army(ArmyInstance& army);
- bool add_navy(NavyInstance& navy);
- bool remove_navy(NavyInstance& navy);
-
template<UnitType::branch_t Branch>
- bool add_unit_instance_group(UnitInstanceGroup<Branch>& group) {
- if constexpr (Branch == UnitType::branch_t::LAND) {
- return add_army(static_cast<ArmyInstance&>(group));
- } else if constexpr (Branch == UnitType::branch_t::NAVAL) {
- return add_navy(static_cast<NavyInstance&>(group));
- } else {
- OpenVic::utility::unreachable();
- }
- }
+ bool add_unit_instance_group(UnitInstanceGroup<Branch>& group);
template<UnitType::branch_t Branch>
- bool remove_unit_instance_group(UnitInstanceGroup<Branch>& group) {
- if constexpr (Branch == UnitType::branch_t::LAND) {
- return remove_army(static_cast<ArmyInstance&>(group));
- } else if constexpr (Branch == UnitType::branch_t::NAVAL) {
- return remove_navy(static_cast<NavyInstance&>(group));
- } else {
- OpenVic::utility::unreachable();
- }
- }
+ bool remove_unit_instance_group(UnitInstanceGroup<Branch>& group);
bool setup(BuildingTypeManager const& building_type_manager);
bool apply_history_to_province(ProvinceHistoryEntry const* entry);