#pragma once #include #include "openvic-simulation/country/CountryInstance.hpp" #include "openvic-simulation/history/HistoryMap.hpp" #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/fixed_point/FixedPointMap.hpp" #include "openvic-simulation/types/IndexedMap.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); ordered_map PROPERTY(accepted_cultures); std::optional PROPERTY(religion); std::optional PROPERTY(ruling_party); std::optional PROPERTY(last_election); IndexedMap 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); ordered_set 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); IndexedMap PROPERTY(government_flag_overrides); ordered_set PROPERTY(decisions); CountryHistoryEntry( CountryDefinition const& new_country, Date new_date, decltype(upper_house)::keys_t const& ideology_keys, decltype(government_flag_overrides)::keys_t const& government_type_keys ); }; class Dataloader; struct DeploymentManager; struct CountryHistoryManager; struct CountryHistoryMap : HistoryMap { friend struct CountryHistoryManager; private: CountryDefinition const& PROPERTY(country); decltype(CountryHistoryEntry::upper_house)::keys_t const& PROPERTY(ideology_keys); decltype(CountryHistoryEntry::government_flag_overrides)::keys_t const& PROPERTY(government_type_keys); protected: CountryHistoryMap( CountryDefinition const& new_country, decltype(ideology_keys) new_ideology_keys, decltype(government_type_keys) new_government_type_keys ); 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, decltype(CountryHistoryMap::ideology_keys) ideology_keys, decltype(CountryHistoryMap::government_type_keys) government_type_keys, ast::NodeCPtr root ); }; }