aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-12-18 23:06:48 +0100
committer GitHub <noreply@github.com>2023-12-18 23:06:48 +0100
commit71dd8f7411f37a6621985d39f3ef45b975884d59 (patch)
tree0c336e402341a141e58206c458c617d2c1e36727
parente35b9ed5d753a6690e720d5403953f89d8f1faad (diff)
parent5ecbade59609265901caf55266af217e309e2d24 (diff)
Merge pull request #172 from OpenVicProject/new-pop-history
New pop history loading + bookmark selection by index
m---------extension/deps/openvic-simulation0
-rw-r--r--extension/src/openvic-extension/singletons/GameSingleton.cpp14
-rw-r--r--extension/src/openvic-extension/singletons/GameSingleton.hpp5
-rw-r--r--game/localisation/en_GB/mapmodes.csv2
-rw-r--r--game/src/Game/GameSession/GameSession.gd2
-rw-r--r--game/src/Game/GameSession/MapView.gd1
6 files changed, 12 insertions, 12 deletions
diff --git a/extension/deps/openvic-simulation b/extension/deps/openvic-simulation
-Subproject 6b9cf7f9dff1570b10a0a0f988e1b1ef418d024
+Subproject 14e47d58b85f657ec1fed8abf88219f09bd3efb
diff --git a/extension/src/openvic-extension/singletons/GameSingleton.cpp b/extension/src/openvic-extension/singletons/GameSingleton.cpp
index ac029d9..a53ba54 100644
--- a/extension/src/openvic-extension/singletons/GameSingleton.cpp
+++ b/extension/src/openvic-extension/singletons/GameSingleton.cpp
@@ -29,7 +29,7 @@ void GameSingleton::_bind_methods() {
OV_BIND_METHOD(GameSingleton::load_defines_compatibility_mode, { "file_paths" });
OV_BIND_SMETHOD(search_for_game_path, { "hint_path" }, DEFVAL(String {}));
- OV_BIND_METHOD(GameSingleton::setup_game);
+ OV_BIND_METHOD(GameSingleton::setup_game, { "bookmark_index" });
OV_BIND_METHOD(GameSingleton::get_province_index_from_uv_coords, { "coords" });
OV_BIND_METHOD(GameSingleton::get_province_info_from_index, { "index" });
@@ -112,15 +112,13 @@ Dataloader const& GameSingleton::get_dataloader() const {
return dataloader;
}
-Error GameSingleton::setup_game() {
- BookmarkManager const& bookmark_manager = game_manager.get_history_manager().get_bookmark_manager();
- if (bookmark_manager.bookmarks_empty()) {
- UtilityFunctions::push_error("No bookmark to load!");
+Error GameSingleton::setup_game(int32_t bookmark_index) {
+ Bookmark const* bookmark = game_manager.get_history_manager().get_bookmark_manager().get_bookmark_by_index(bookmark_index);
+ if (bookmark == nullptr) {
+ UtilityFunctions::push_error("Failed to get bookmark with index: ", bookmark_index);
return FAILED;
}
- bool ret = game_manager.load_bookmark(&bookmark_manager.get_bookmarks().front());
- // TODO - load pop history with the new history system
- ret &= dataloader.load_pop_history(game_manager, "history/pops/" + game_manager.get_today().to_string());
+ bool ret = game_manager.load_bookmark(bookmark);
for (Province& province : game_manager.get_map().get_provinces()) {
province.set_crime(
game_manager.get_crime_manager().get_crime_modifier_by_index(
diff --git a/extension/src/openvic-extension/singletons/GameSingleton.hpp b/extension/src/openvic-extension/singletons/GameSingleton.hpp
index 5895899..5559f1b 100644
--- a/extension/src/openvic-extension/singletons/GameSingleton.hpp
+++ b/extension/src/openvic-extension/singletons/GameSingleton.hpp
@@ -56,9 +56,8 @@ namespace OpenVic {
static godot::String search_for_game_path(godot::String hint_path = {});
- /* Post-load/restart game setup - reset the game to post-load state
- * and (re)generate starting data, e.g. buildings. */
- godot::Error setup_game();
+ /* Post-load/restart game setup - reset the game to post-load state and load the specified bookmark. */
+ godot::Error setup_game(int32_t bookmark_index);
int32_t get_province_index_from_uv_coords(godot::Vector2 const& coords) const;
diff --git a/game/localisation/en_GB/mapmodes.csv b/game/localisation/en_GB/mapmodes.csv
index 0372192..f3e6417 100644
--- a/game/localisation/en_GB/mapmodes.csv
+++ b/game/localisation/en_GB/mapmodes.csv
@@ -11,3 +11,5 @@ mapmode_infrastructure;Infrastructure
mapmode_population;Population Density
mapmode_culture;Nationality
mapmode_religion;Religion
+mapmode_adjacencies;Adjacencies
+mapmode_port;Ports
diff --git a/game/src/Game/GameSession/GameSession.gd b/game/src/Game/GameSession/GameSession.gd
index 2a27e3d..305709c 100644
--- a/game/src/Game/GameSession/GameSession.gd
+++ b/game/src/Game/GameSession/GameSession.gd
@@ -4,7 +4,7 @@ extends Control
func _ready():
Events.Options.load_settings_from_file()
- if GameSingleton.setup_game() != OK:
+ if GameSingleton.setup_game(0) != OK:
push_error("Failed to setup game")
func _process(_delta : float):
diff --git a/game/src/Game/GameSession/MapView.gd b/game/src/Game/GameSession/MapView.gd
index 62bdd20..01e5844 100644
--- a/game/src/Game/GameSession/MapView.gd
+++ b/game/src/Game/GameSession/MapView.gd
@@ -129,6 +129,7 @@ func zoom_out() -> void:
func _on_province_selected(index : int) -> void:
_map_shader_material.set_shader_parameter(GameLoader.ShaderManager.param_selected_index, index)
+ print("Province selected with index: ", index)
# REQUIREMENTS
# * SS-31