aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/MapInstance.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-06-07 00:20:58 +0200
committer hop311 <hop3114@gmail.com>2024-06-07 12:28:16 +0200
commit1198a780916e65cae048dd3478f614c1d18db846 (patch)
treef681dd2e76d489ba6e7beea44ae6ebd59e9d51f3 /src/openvic-simulation/map/MapInstance.hpp
parentc94a06477fc3930e8f8f2e5f971fc4b5b838ea0d (diff)
Separated MapDefinition and MapInstancemap-instance
Diffstat (limited to 'src/openvic-simulation/map/MapInstance.hpp')
-rw-r--r--src/openvic-simulation/map/MapInstance.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/MapInstance.hpp b/src/openvic-simulation/map/MapInstance.hpp
new file mode 100644
index 0000000..1f87326
--- /dev/null
+++ b/src/openvic-simulation/map/MapInstance.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include "openvic-simulation/map/ProvinceDefinition.hpp"
+#include "openvic-simulation/map/ProvinceInstance.hpp"
+#include "openvic-simulation/map/State.hpp"
+#include "openvic-simulation/types/Date.hpp"
+#include "openvic-simulation/types/IdentifierRegistry.hpp"
+
+namespace OpenVic {
+ struct MapDefinition;
+ struct BuildingTypeManager;
+ struct ProvinceHistoryManager;
+ struct IdeologyManager;
+ struct IssueManager;
+ struct Country;
+
+ /* REQUIREMENTS:
+ * MAP-4
+ */
+ struct MapInstance {
+ MapDefinition const& PROPERTY(map_definition);
+
+ IdentifierRegistry<ProvinceInstance> IDENTIFIER_REGISTRY_CUSTOM_INDEX_OFFSET(province_instance, 1);
+
+ ProvinceInstance* PROPERTY(selected_province); // is it right for this to be mutable? how about using an index instead?
+ Pop::pop_size_t PROPERTY(highest_province_population);
+ Pop::pop_size_t PROPERTY(total_map_population);
+
+ StateManager PROPERTY_REF(state_manager);
+
+ public:
+ MapInstance(MapDefinition const& new_map_definition);
+
+ inline explicit constexpr operator MapDefinition const&() const {
+ return map_definition;
+ }
+
+ IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS_CUSTOM_INDEX_OFFSET(province_instance, 1);
+
+ ProvinceInstance* get_province_instance_from_const(ProvinceDefinition const* province);
+ ProvinceInstance const* get_province_instance_from_const(ProvinceDefinition const* province) const;
+
+ void set_selected_province(ProvinceDefinition::index_t index);
+ ProvinceInstance* get_selected_province();
+ ProvinceDefinition::index_t get_selected_province_index() const;
+
+ bool reset(BuildingTypeManager const& building_type_manager);
+ bool apply_history_to_provinces(
+ ProvinceHistoryManager const& history_manager, Date date, IdeologyManager const& ideology_manager,
+ IssueManager const& issue_manager, Country const& country
+ );
+
+ void update_gamestate(Date today);
+ void tick(Date today);
+ };
+}