aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/UnitInstanceGroup.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-07-21 15:09:25 +0200
committer hop311 <hop3114@gmail.com>2024-07-22 20:21:27 +0200
commit67cbd14630c4344902d3fa1ddca178809da4293b (patch)
tree9df96829dd0f9a0bd7c2e6b0e047547aa4bff3a7 /src/openvic-simulation/military/UnitInstanceGroup.cpp
parentd1f3a96b72dd06b5f97dd4643e5f016a02b42ea6 (diff)
Fleshing out Country, State and Province instances + historycountry-instance
Diffstat (limited to 'src/openvic-simulation/military/UnitInstanceGroup.cpp')
-rw-r--r--src/openvic-simulation/military/UnitInstanceGroup.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/openvic-simulation/military/UnitInstanceGroup.cpp b/src/openvic-simulation/military/UnitInstanceGroup.cpp
index 80ca3a9..07736f3 100644
--- a/src/openvic-simulation/military/UnitInstanceGroup.cpp
+++ b/src/openvic-simulation/military/UnitInstanceGroup.cpp
@@ -155,6 +155,17 @@ UnitInstanceGroupBranched<UnitType::branch_t::NAVAL>::UnitInstanceGroupBranched(
std::vector<ShipInstance*>&& new_units
) : UnitInstanceGroup { new_name, std::move(new_units) } {}
+
+fixed_point_t UnitInstanceGroupBranched<UnitType::branch_t::NAVAL>::get_total_consumed_supply() const {
+ fixed_point_t total_consumed_supply = 0;
+
+ for (ShipInstance const* ship : get_units()) {
+ total_consumed_supply += ship->get_unit_type().get_supply_consumption_score();
+ }
+
+ return total_consumed_supply;
+}
+
template<UnitType::branch_t Branch>
bool UnitInstanceManager::generate_unit_instance(
UnitDeployment<Branch> const& unit_deployment, UnitInstanceBranched<Branch>*& unit_instance
@@ -220,7 +231,7 @@ bool UnitInstanceManager::generate_unit_instance_group(
});
ret &= unit_instance_group.set_position(
- map_instance.get_province_instance_from_const(unit_deployment_group.get_location())
+ &map_instance.get_province_instance_from_definition(*unit_deployment_group.get_location())
);
ret &= unit_instance_group.set_country(&country);