aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/history/ProvinceHistory.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-06-04 00:39:34 +0200
committer hop311 <hop3114@gmail.com>2024-06-06 19:39:35 +0200
commit37cdd775ac738b2a1264e32471385376e5a34f3a (patch)
treef3a9a107f1bd4b6b6d8035a96ac659bcc15f176b /src/openvic-simulation/history/ProvinceHistory.hpp
parente286cfef29d7c431ba33cd77283e838e6fba05d2 (diff)
Province const/mutable separation + State cleanupconst-mutable
Diffstat (limited to 'src/openvic-simulation/history/ProvinceHistory.hpp')
-rw-r--r--src/openvic-simulation/history/ProvinceHistory.hpp44
1 files changed, 29 insertions, 15 deletions
diff --git a/src/openvic-simulation/history/ProvinceHistory.hpp b/src/openvic-simulation/history/ProvinceHistory.hpp
index 7611907..27d744d 100644
--- a/src/openvic-simulation/history/ProvinceHistory.hpp
+++ b/src/openvic-simulation/history/ProvinceHistory.hpp
@@ -1,39 +1,49 @@
#pragma once
+#include <optional>
#include <vector>
-#include "openvic-simulation/country/Country.hpp"
#include "openvic-simulation/economy/BuildingType.hpp"
-#include "openvic-simulation/economy/Good.hpp"
#include "openvic-simulation/history/HistoryMap.hpp"
-#include "openvic-simulation/map/Province.hpp"
-#include "openvic-simulation/map/TerrainType.hpp"
+#include "openvic-simulation/map/ProvinceInstance.hpp"
+#include "openvic-simulation/pop/Pop.hpp"
+#include "openvic-simulation/types/Date.hpp"
+#include "openvic-simulation/types/fixed_point/FixedPointMap.hpp"
#include "openvic-simulation/types/OrderedContainers.hpp"
+#include "openvic-simulation/utility/Getters.hpp"
namespace OpenVic {
struct ProvinceHistoryMap;
+ struct ProvinceDefinition;
+ struct Country;
+ struct Good;
+ struct TerrainType;
+ struct Ideology;
+ struct GameManager;
struct ProvinceHistoryEntry : HistoryEntry {
friend struct ProvinceHistoryMap;
private:
- Province const& PROPERTY(province);
+ ProvinceDefinition const& PROPERTY(province);
std::optional<Country const*> PROPERTY(owner);
std::optional<Country const*> PROPERTY(controller);
- std::optional<Province::colony_status_t> PROPERTY(colonial);
+ std::optional<ProvinceInstance::colony_status_t> PROPERTY(colonial);
std::optional<bool> PROPERTY(slave);
std::vector<Country const*> PROPERTY(add_cores);
std::vector<Country const*> PROPERTY(remove_cores);
std::optional<Good const*> PROPERTY(rgo);
- std::optional<Province::life_rating_t> PROPERTY(life_rating);
+ std::optional<ProvinceInstance::life_rating_t> PROPERTY(life_rating);
std::optional<TerrainType const*> PROPERTY(terrain_type);
ordered_map<BuildingType const*, BuildingType::level_t> PROPERTY(province_buildings);
ordered_map<BuildingType const*, BuildingType::level_t> PROPERTY(state_buildings);
fixed_point_map_t<Ideology const*> PROPERTY(party_loyalties);
+
+ // TODO - use minimal pop representation (size, type, culture, religion, consciousness, militancy, rebel type)
std::vector<Pop> PROPERTY(pops);
- ProvinceHistoryEntry(Province const& new_province, Date new_date);
+ ProvinceHistoryEntry(ProvinceDefinition const& new_province, Date new_date);
bool _load_province_pop_history(GameManager const& game_manager, ast::NodeCPtr root, bool *non_integer_size);
};
@@ -44,10 +54,10 @@ namespace OpenVic {
friend struct ProvinceHistoryManager;
private:
- Province const& PROPERTY(province);
+ ProvinceDefinition const& PROPERTY(province);
protected:
- ProvinceHistoryMap(Province const& new_province);
+ ProvinceHistoryMap(ProvinceDefinition const& new_province);
std::unique_ptr<ProvinceHistoryEntry> _make_entry(Date date) const override;
bool _load_history_entry(GameManager const& game_manager, ProvinceHistoryEntry& entry, ast::NodeCPtr root) override;
@@ -58,12 +68,14 @@ namespace OpenVic {
);
};
+ struct Map;
+
struct ProvinceHistoryManager {
private:
- ordered_map<Province const*, ProvinceHistoryMap> province_histories;
+ ordered_map<ProvinceDefinition const*, ProvinceHistoryMap> province_histories;
bool locked = false;
- ProvinceHistoryMap* _get_or_make_province_history(Province const& province);
+ ProvinceHistoryMap* _get_or_make_province_history(ProvinceDefinition const& province);
public:
ProvinceHistoryManager() = default;
@@ -72,9 +84,11 @@ namespace OpenVic {
void lock_province_histories(Map const& map, bool detailed_errors);
bool is_locked() const;
- ProvinceHistoryMap const* get_province_history(Province const* province) const;
+ ProvinceHistoryMap const* get_province_history(ProvinceDefinition const* province) const;
- bool load_province_history_file(GameManager const& game_manager, Province const& province, ast::NodeCPtr root);
+ bool load_province_history_file(
+ GameManager const& game_manager, ProvinceDefinition const& province, ast::NodeCPtr root
+ );
bool load_pop_history_file(GameManager const& game_manager, Date date, ast::NodeCPtr root, bool *non_integer_size);
};
-} // namespace OpenVic
+}