From d8baf57d46539da9edba5952f73089bf9a54bdaf Mon Sep 17 00:00:00 2001 From: hop311 Date: Thu, 18 Jul 2024 23:25:38 +0100 Subject: Unit position/country/leader handling + more use of unit branch templates --- src/openvic-simulation/military/UnitInstance.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/openvic-simulation/military/UnitInstance.cpp') 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 +UnitInstance::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 +void UnitInstance::set_unit_name(std::string_view new_unit_name) { + unit_name = new_unit_name; +} + +template struct OpenVic::UnitInstance; +template struct OpenVic::UnitInstance; + UnitInstanceBranched::UnitInstanceBranched( std::string_view new_name, RegimentType const& new_regiment_type, Pop* new_pop ) : UnitInstance { new_name, new_regiment_type }, pop { new_pop } {} -- cgit v1.2.3-56-ga3b1