diff options
author | hop311 <hop3114@gmail.com> | 2024-04-15 00:29:28 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-04-15 00:38:46 +0200 |
commit | 5799836bee29024ce8a2d0fc45e06664c0110751 (patch) | |
tree | 54a0ad26ef3cec9a56644479611e8abaad62b1f7 /src/openvic-simulation/military/Deployment.hpp | |
parent | 109d31f147512c8d51f35f9773cd3c6bb1b8b994 (diff) |
Generate starting unit instancesunits
Diffstat (limited to 'src/openvic-simulation/military/Deployment.hpp')
-rw-r--r-- | src/openvic-simulation/military/Deployment.hpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/openvic-simulation/military/Deployment.hpp b/src/openvic-simulation/military/Deployment.hpp index 742914d..8966397 100644 --- a/src/openvic-simulation/military/Deployment.hpp +++ b/src/openvic-simulation/military/Deployment.hpp @@ -11,48 +11,64 @@ namespace OpenVic { struct RegimentDeployment { + friend struct DeploymentManager; + private: std::string PROPERTY(name); - RegimentType const* PROPERTY(type); + RegimentType const& PROPERTY(type); Province const* PROPERTY(home); + RegimentDeployment(std::string_view new_name, RegimentType const& new_type, Province const* new_home); + public: - RegimentDeployment(std::string_view new_name, RegimentType const* new_type, Province const* new_home); + RegimentDeployment(RegimentDeployment&&) = default; }; struct ShipDeployment { + friend struct DeploymentManager; + private: std::string PROPERTY(name); - ShipType const* PROPERTY(type); + ShipType const& PROPERTY(type); + + ShipDeployment(std::string_view new_name, ShipType const& new_type); public: - ShipDeployment(std::string_view new_name, ShipType const* new_type); + ShipDeployment(ShipDeployment&&) = default; }; struct ArmyDeployment { + friend struct DeploymentManager; + private: std::string PROPERTY(name); Province const* PROPERTY(location); std::vector<RegimentDeployment> PROPERTY(regiments); + ArmyDeployment( + std::string_view new_name, Province const* new_location, std::vector<RegimentDeployment>&& new_regiments + ); + public: - ArmyDeployment(std::string_view new_name, Province const* new_location, std::vector<RegimentDeployment>&& new_regiments); + ArmyDeployment(ArmyDeployment&&) = default; }; struct NavyDeployment { + friend struct DeploymentManager; + private: std::string PROPERTY(name); Province const* PROPERTY(location); std::vector<ShipDeployment> PROPERTY(ships); - public: NavyDeployment(std::string_view new_name, Province const* new_location, std::vector<ShipDeployment>&& new_ships); + + public: + NavyDeployment(NavyDeployment&&) = default; }; struct Deployment : HasIdentifier { - friend std::unique_ptr<Deployment> std::make_unique<Deployment>( - std::string_view&&, std::vector<OpenVic::ArmyDeployment>&&, std::vector<OpenVic::NavyDeployment>&&, std::vector<OpenVic::Leader>&& - ); + friend struct DeploymentManager; private: std::vector<ArmyDeployment> PROPERTY(armies); @@ -70,18 +86,20 @@ namespace OpenVic { struct DeploymentManager { private: - IdentifierInstanceRegistry<Deployment> IDENTIFIER_REGISTRY(deployment); + IdentifierRegistry<Deployment> IDENTIFIER_REGISTRY(deployment); string_set_t missing_oob_files; public: bool add_deployment( - std::string_view path, std::vector<ArmyDeployment>&& armies, std::vector<NavyDeployment>&& navies, std::vector<Leader>&& leaders + std::string_view path, std::vector<ArmyDeployment>&& armies, std::vector<NavyDeployment>&& navies, + std::vector<Leader>&& leaders ); bool load_oob_file( GameManager const& game_manager, Dataloader const& dataloader, std::string_view history_path, Deployment const*& deployment, bool fail_on_missing ); + size_t get_missing_oob_file_count() const; }; } // namespace OpenVic |