diff options
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 |