diff options
author | Hop311 <Hop3114@gmail.com> | 2024-06-06 21:29:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-06 21:29:15 +0200 |
commit | f5d173e88a49a1a9556860063aef1aa287925cfd (patch) | |
tree | f3a9a107f1bd4b6b6d8035a96ac659bcc15f176b /src/openvic-simulation/military/UnitInstance.hpp | |
parent | e286cfef29d7c431ba33cd77283e838e6fba05d2 (diff) | |
parent | 37cdd775ac738b2a1264e32471385376e5a34f3a (diff) |
Merge pull request #161 from OpenVicProject/const-mutable
Province const/mutable separation + State cleanup
Diffstat (limited to 'src/openvic-simulation/military/UnitInstance.hpp')
-rw-r--r-- | src/openvic-simulation/military/UnitInstance.hpp | 28 |
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); |