aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/UnitInstance.cpp
blob: 7c6488d73391cb134dea2cd13c15bfa2ed7ab6cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "UnitInstance.hpp"

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, bool new_mobilised
) : UnitInstance { new_name, new_regiment_type }, pop { new_pop }, mobilised { new_mobilised } {}

UnitInstanceBranched<UnitType::branch_t::NAVAL>::UnitInstanceBranched(
   std::string_view new_name, ShipType const& new_ship_type
) : UnitInstance { new_name, new_ship_type } {}