aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/GameManager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/GameManager.hpp')
-rw-r--r--src/openvic-simulation/GameManager.hpp84
1 files changed, 27 insertions, 57 deletions
diff --git a/src/openvic-simulation/GameManager.hpp b/src/openvic-simulation/GameManager.hpp
index 55ba37c..0a24692 100644
--- a/src/openvic-simulation/GameManager.hpp
+++ b/src/openvic-simulation/GameManager.hpp
@@ -1,72 +1,42 @@
#pragma once
-#include "openvic-simulation/country/Country.hpp"
-#include "openvic-simulation/diplomacy/DiplomacyManager.hpp"
-#include "openvic-simulation/economy/EconomyManager.hpp"
-#include "openvic-simulation/history/HistoryManager.hpp"
-#include "openvic-simulation/interface/UI.hpp"
-#include "openvic-simulation/map/Crime.hpp"
-#include "openvic-simulation/map/MapDefinition.hpp"
-#include "openvic-simulation/map/MapInstance.hpp"
-#include "openvic-simulation/map/Mapmode.hpp"
-#include "openvic-simulation/military/MilitaryManager.hpp"
-#include "openvic-simulation/misc/Decision.hpp"
-#include "openvic-simulation/misc/Define.hpp"
-#include "openvic-simulation/misc/Event.hpp"
-#include "openvic-simulation/misc/Modifier.hpp"
-#include "openvic-simulation/misc/SimulationClock.hpp"
-#include "openvic-simulation/politics/PoliticsManager.hpp"
-#include "openvic-simulation/pop/Pop.hpp"
-#include "openvic-simulation/research/ResearchManager.hpp"
-#include "openvic-simulation/scripts/ScriptManager.hpp"
+#include <optional>
+
+#include "openvic-simulation/dataloader/Dataloader.hpp"
+#include "openvic-simulation/DefinitionManager.hpp"
+#include "openvic-simulation/InstanceManager.hpp"
namespace OpenVic {
struct GameManager {
- using gamestate_updated_func_t = std::function<void()>;
-
private:
- DefineManager PROPERTY_REF(define_manager);
- EconomyManager PROPERTY_REF(economy_manager);
- MilitaryManager PROPERTY_REF(military_manager);
- ModifierManager PROPERTY_REF(modifier_manager);
- PoliticsManager PROPERTY_REF(politics_manager);
- HistoryManager PROPERTY_REF(history_manager);
- ResearchManager PROPERTY_REF(research_manager);
- PopManager PROPERTY_REF(pop_manager);
- CountryManager PROPERTY_REF(country_manager);
- CountryInstanceManager PROPERTY_REF(country_instance_manager);
- CrimeManager PROPERTY_REF(crime_manager);
- EventManager PROPERTY_REF(event_manager);
- DecisionManager PROPERTY_REF(decision_manager);
- UIManager PROPERTY_REF(ui_manager);
- DiplomacyManager PROPERTY_REF(diplomacy_manager);
- /* Near the end so it is freed after other managers that may depend on it,
- * e.g. if we want to remove military units from the province they're in when they're destructed. */
- MapDefinition PROPERTY_REF(map_definition);
- MapInstance PROPERTY_REF(map_instance);
- MapmodeManager PROPERTY_REF(mapmode_manager);
- ScriptManager PROPERTY_REF(script_manager);
- SimulationClock PROPERTY_REF(simulation_clock);
+ Dataloader PROPERTY(dataloader);
+ DefinitionManager PROPERTY(definition_manager);
+ std::optional<InstanceManager> instance_manager;
- time_t session_start; /* SS-54, as well as allowing time-tracking */
- Bookmark const* PROPERTY(bookmark);
- Date PROPERTY(today);
- gamestate_updated_func_t gamestate_updated;
- bool gamestate_needs_update, currently_updating_gamestate;
-
- void set_gamestate_needs_update();
- void update_gamestate();
- void tick();
+ InstanceManager::gamestate_updated_func_t gamestate_updated_callback;
+ SimulationClock::state_changed_function_t clock_state_changed_callback;
+ bool PROPERTY_CUSTOM_PREFIX(definitions_loaded, are);
public:
GameManager(
- gamestate_updated_func_t gamestate_updated_callback,
- SimulationClock::state_changed_function_t clock_state_changed_callback
+ InstanceManager::gamestate_updated_func_t new_gamestate_updated_callback,
+ SimulationClock::state_changed_function_t new_clock_state_changed_callback
+ );
+
+ inline constexpr InstanceManager* get_instance_manager() {
+ return instance_manager ? &*instance_manager : nullptr;
+ }
+
+ inline constexpr InstanceManager const* get_instance_manager() const {
+ return instance_manager ? &*instance_manager : nullptr;
+ }
+
+ bool load_definitions(
+ Dataloader::path_vector_t const& roots, Dataloader::localisation_callback_t localisation_callback
);
- bool reset();
- bool load_bookmark(Bookmark const* new_bookmark);
+ bool setup_instance(Bookmark const* bookmark);
- bool expand_selected_province_building(size_t building_index);
+ bool start_game_session();
};
}