#pragma once #include #include #include "openvic-simulation/history/HistoryMap.hpp" #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/fixed_point/FixedPointMap.hpp" #include "openvic-simulation/types/OrderedContainers.hpp" namespace OpenVic { struct CountryHistoryMap; struct CountryDefinition; struct Culture; struct Religion; struct CountryParty; struct Ideology; struct ProvinceDefinition; struct GovernmentType; struct NationalValue; struct Reform; struct Deployment; struct TechnologySchool; struct Technology; struct Invention; struct Decision; struct CountryHistoryEntry : HistoryEntry { friend struct CountryHistoryMap; private: CountryDefinition const& PROPERTY(country); std::optional PROPERTY(primary_culture); std::vector PROPERTY(accepted_cultures); std::optional PROPERTY(religion); std::optional PROPERTY(ruling_party); std::optional PROPERTY(last_election); fixed_point_map_t PROPERTY(upper_house); std::optional PROPERTY(capital); std::optional PROPERTY(government_type); std::optional PROPERTY(plurality); std::optional PROPERTY(national_value); std::optional PROPERTY_CUSTOM_PREFIX(civilised, is); std::optional PROPERTY(prestige); std::vector PROPERTY(reforms); std::optional PROPERTY(inital_oob); std::optional PROPERTY(tech_school); ordered_map PROPERTY(technologies); ordered_map PROPERTY(inventions); fixed_point_map_t PROPERTY(foreign_investment); std::optional PROPERTY(consciousness); std::optional PROPERTY(nonstate_consciousness); std::optional PROPERTY(literacy); std::optional PROPERTY(nonstate_culture_literacy); std::optional PROPERTY_CUSTOM_PREFIX(releasable_vassal, is); std::optional PROPERTY(colonial_points); string_set_t PROPERTY(country_flags); string_set_t PROPERTY(global_flags); ordered_map PROPERTY(government_flag_overrides); ordered_set PROPERTY(decisions); CountryHistoryEntry(CountryDefinition const& new_country, Date new_date); }; class Dataloader; struct DeploymentManager; struct CountryHistoryManager; struct CountryHistoryMap : HistoryMap { friend struct CountryHistoryManager; private: CountryDefinition const& PROPERTY(country); protected: CountryHistoryMap(CountryDefinition const& new_country); std::unique_ptr _make_entry(Date date) const override; bool _load_history_entry( DefinitionManager const& definition_manager, Dataloader const& dataloader, DeploymentManager& deployment_manager, CountryHistoryEntry& entry, ast::NodeCPtr root ) override; }; struct CountryHistoryManager { private: ordered_map country_histories; bool locked = false; public: CountryHistoryManager() = default; void reserve_more_country_histories(size_t size); void lock_country_histories(); bool is_locked() const; CountryHistoryMap const* get_country_history(CountryDefinition const* country) const; bool load_country_history_file( DefinitionManager& definition_manager, Dataloader const& dataloader, CountryDefinition const& country, ast::NodeCPtr root ); }; }