aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/UnitInstance.cpp
diff options
context:
space:
mode:
author zaaarf <me@zaaarf.foo>2024-02-12 12:15:04 +0100
committer zaaarf <me@zaaarf.foo>2024-03-16 14:01:15 +0100
commit023860d53a90774dcdba84ad7c0dca3c944c9a49 (patch)
treed5b186facf7c3a08e6ccf2e8261b7de054957a41 /src/openvic-simulation/military/UnitInstance.cpp
parent2c892c99a6647be15ef23cabf6cc40f08769283d (diff)
feat: unit instance type definition, renamed existing structs for consistencymilitary-units
Diffstat (limited to 'src/openvic-simulation/military/UnitInstance.cpp')
-rw-r--r--src/openvic-simulation/military/UnitInstance.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/openvic-simulation/military/UnitInstance.cpp b/src/openvic-simulation/military/UnitInstance.cpp
new file mode 100644
index 0000000..7927b0f
--- /dev/null
+++ b/src/openvic-simulation/military/UnitInstance.cpp
@@ -0,0 +1,31 @@
+#include "UnitInstance.hpp"
+#include <vector>
+#include "openvic-simulation/military/UnitType.hpp"
+
+using namespace OpenVic;
+
+RegimentInstance::RegimentInstance(std::string_view new_name, RegimentType const& new_regiment_type, Pop& new_pop)
+ : UnitInstance { new_name, new_regiment_type }, pop { new_pop } {}
+
+ShipInstance::ShipInstance(std::string_view new_name, ShipType const& new_ship_type)
+ : UnitInstance { new_name, new_ship_type } {}
+
+MovementInfo::MovementInfo() : path {}, movement_progress {} {}
+
+//TODO: pathfinding logic
+MovementInfo::MovementInfo(Province const* starting_province, Province const* target_province)
+ : path { std::vector { starting_province, target_province } }, movement_progress { 0 } {}
+
+ArmyInstance::ArmyInstance(
+ std::string_view new_name,
+ std::vector<RegimentInstance*>&& new_units,
+ Leader const* new_leader,
+ Province const* new_position
+) : UnitInstanceGroup { new_name, UnitType::branch_t::LAND, std::move(new_units), new_leader, new_position } {}
+
+NavyInstance::NavyInstance(
+ std::string_view new_name,
+ std::vector<ShipInstance*>&& new_units,
+ Leader const* new_leader,
+ Province const* new_position
+) : UnitInstanceGroup { new_name, UnitType::branch_t::NAVAL, std::move(new_units), new_leader, new_position } {} \ No newline at end of file