aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/UnitInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/military/UnitInstance.cpp')
-rw-r--r--src/openvic-simulation/military/UnitInstance.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/openvic-simulation/military/UnitInstance.cpp b/src/openvic-simulation/military/UnitInstance.cpp
index 1f49205..d9f12b9 100644
--- a/src/openvic-simulation/military/UnitInstance.cpp
+++ b/src/openvic-simulation/military/UnitInstance.cpp
@@ -2,6 +2,22 @@
using namespace OpenVic;
+template<UnitType::branch_t Branch>
+UnitInstance<Branch>::UnitInstance(std::string_view new_unit_name, _UnitType const& new_unit_type)
+ : unit_name { new_unit_name },
+ unit_type { new_unit_type },
+ organisation { new_unit_type.get_default_organisation() },
+ morale { 0 },
+ strength { new_unit_type.get_max_strength() } {}
+
+template<UnitType::branch_t Branch>
+void UnitInstance<Branch>::set_unit_name(std::string_view new_unit_name) {
+ unit_name = new_unit_name;
+}
+
+template struct OpenVic::UnitInstance<UnitType::branch_t::LAND>;
+template struct OpenVic::UnitInstance<UnitType::branch_t::NAVAL>;
+
UnitInstanceBranched<UnitType::branch_t::LAND>::UnitInstanceBranched(
std::string_view new_name, RegimentType const& new_regiment_type, Pop* new_pop
) : UnitInstance { new_name, new_regiment_type }, pop { new_pop } {}