aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/UnitInstance.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-06-04 00:39:34 +0200
committer hop311 <hop3114@gmail.com>2024-06-06 19:39:35 +0200
commit37cdd775ac738b2a1264e32471385376e5a34f3a (patch)
treef3a9a107f1bd4b6b6d8035a96ac659bcc15f176b /src/openvic-simulation/military/UnitInstance.hpp
parente286cfef29d7c431ba33cd77283e838e6fba05d2 (diff)
Province const/mutable separation + State cleanupconst-mutable
Diffstat (limited to 'src/openvic-simulation/military/UnitInstance.hpp')
-rw-r--r--src/openvic-simulation/military/UnitInstance.hpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/openvic-simulation/military/UnitInstance.hpp b/src/openvic-simulation/military/UnitInstance.hpp
index e3d541a..a3a53d0 100644
--- a/src/openvic-simulation/military/UnitInstance.hpp
+++ b/src/openvic-simulation/military/UnitInstance.hpp
@@ -1,14 +1,14 @@
#pragma once
#include <concepts>
+#include <string>
#include <string_view>
#include <vector>
-#include "openvic-simulation/map/Province.hpp"
-#include "openvic-simulation/military/Deployment.hpp"
#include "openvic-simulation/military/Leader.hpp"
#include "openvic-simulation/military/UnitType.hpp"
#include "openvic-simulation/types/fixed_point/FixedPoint.hpp"
+#include "openvic-simulation/utility/Getters.hpp"
namespace OpenVic {
template<std::derived_from<UnitType> T>
@@ -37,6 +37,8 @@ namespace OpenVic {
}
};
+ struct Pop;
+
struct RegimentInstance : UnitInstance<RegimentType> {
friend struct UnitInstanceManager;
@@ -59,14 +61,17 @@ namespace OpenVic {
ShipInstance(ShipInstance&&) = default;
};
+ struct ProvinceInstance;
+
struct MovementInfo {
private:
- std::vector<Province const*> PROPERTY(path);
+ std::vector<ProvinceInstance const*> PROPERTY(path);
fixed_point_t PROPERTY(movement_progress);
public:
MovementInfo();
- MovementInfo(Province const* starting_province, Province const* target_province); // contains/calls pathfinding logic
+ // contains/calls pathfinding logic
+ MovementInfo(ProvinceInstance const* starting_province, ProvinceInstance const* target_province);
};
struct CountryInstance;
@@ -82,7 +87,7 @@ namespace OpenVic {
MovementInfo PROPERTY_REF(movement_info);
protected:
- Province* PROPERTY_ACCESS(position, protected);
+ ProvinceInstance* PROPERTY_ACCESS(position, protected);
CountryInstance* PROPERTY_ACCESS(country, protected);
UnitInstanceGroup(
@@ -140,7 +145,7 @@ namespace OpenVic {
)->first;
}
- virtual void set_position(Province* new_position) = 0;
+ virtual void set_position(ProvinceInstance* new_position) = 0;
};
struct ArmyInstance : UnitInstanceGroup<RegimentInstance> {
@@ -157,7 +162,7 @@ namespace OpenVic {
public:
ArmyInstance(ArmyInstance&&) = default;
- void set_position(Province* new_position) override;
+ void set_position(ProvinceInstance* new_position) override;
};
struct NavyInstance : UnitInstanceGroup<ShipInstance> {
@@ -176,9 +181,16 @@ namespace OpenVic {
public:
NavyInstance(NavyInstance&&) = default;
- void set_position(Province* new_position) override;
+ void set_position(ProvinceInstance* new_position) override;
};
+ struct RegimentDeployment;
+ struct ShipDeployment;
+ struct Map;
+ struct ArmyDeployment;
+ struct NavyDeployment;
+ struct Deployment;
+
struct UnitInstanceManager {
private:
std::deque<RegimentInstance> PROPERTY(regiments);