#pragma once #include #include #include #include "openvic-simulation/military/UnitType.hpp" #include "openvic-simulation/types/fixed_point/FixedPoint.hpp" #include "openvic-simulation/utility/Getters.hpp" namespace OpenVic { template struct UnitInstance { using _UnitType = UnitTypeBranched; private: std::string PROPERTY(unit_name); _UnitType const& PROPERTY(unit_type); fixed_point_t PROPERTY_RW(organisation); fixed_point_t PROPERTY_RW(morale); fixed_point_t PROPERTY_RW(strength); protected: UnitInstance(std::string_view new_unit_name, _UnitType const& new_unit_type) : unit_name { new_unit_name }, unit_type { new_unit_type }, organisation { new_unit_type.get_default_organisation() }, //TODO: modifiers morale { 0 }, //TODO: modifiers strength { new_unit_type.get_max_strength() } {} public: UnitInstance(UnitInstance&&) = default; void set_unit_name(std::string_view new_unit_name) { unit_name = new_unit_name; } }; struct Pop; template struct UnitInstanceBranched; template<> struct UnitInstanceBranched : UnitInstance { friend struct UnitInstanceManager; private: Pop* PROPERTY(pop); UnitInstanceBranched(std::string_view new_name, RegimentType const& new_regiment_type, Pop* new_pop); public: UnitInstanceBranched(UnitInstanceBranched&&) = default; }; using RegimentInstance = UnitInstanceBranched; template<> struct UnitInstanceBranched : UnitInstance { friend struct UnitInstanceManager; private: UnitInstanceBranched(std::string_view new_name, ShipType const& new_ship_type); public: UnitInstanceBranched(UnitInstanceBranched&&) = default; }; using ShipInstance = UnitInstanceBranched; }