From 0e1be49ee88c9736cbc3e92dcad273f932a8a33a Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 8 Jan 2025 00:00:59 +0000 Subject: [PATCH] Fix no province map crash --- extension/deps/openvic-simulation | 2 +- game/src/Game/GameSession/MapView.gd | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/extension/deps/openvic-simulation b/extension/deps/openvic-simulation index 01b7f377..859723ce 160000 --- a/extension/deps/openvic-simulation +++ b/extension/deps/openvic-simulation @@ -1 +1 @@ -Subproject commit 01b7f377f7932a5bf5067e468de8868dc50b538c +Subproject commit 859723ced0444339ae3724b2bbfc0a7e99f7990a diff --git a/game/src/Game/GameSession/MapView.gd b/game/src/Game/GameSession/MapView.gd index 6bf84f30..1d837f85 100644 --- a/game/src/Game/GameSession/MapView.gd +++ b/game/src/Game/GameSession/MapView.gd @@ -167,7 +167,8 @@ func zoom_out() -> void: _zoom_position = Vector2() func set_hovered_province_index(hover_index : int) -> void: - _map_shader_material.set_shader_parameter(GameLoader.ShaderManager.param_hover_index, hover_index) + if _map_shader_material: + _map_shader_material.set_shader_parameter(GameLoader.ShaderManager.param_hover_index, hover_index) func set_hovered_province_at(pos : Vector2) -> void: var hover_index := GameSingleton.get_province_index_from_uv_coords(pos) @@ -188,8 +189,9 @@ func _update_province_hover() -> void: set_hovered_province_at(_viewport_to_map_coords(_mouse_pos_viewport)) 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) + if _map_shader_material: + _map_shader_material.set_shader_parameter(GameLoader.ShaderManager.param_selected_index, index) + print("Province selected with index: ", index) func _input(event : InputEvent) -> void: if event is InputEventMouseMotion: @@ -324,7 +326,8 @@ func _zoom_process(delta : float) -> void: # TODO - smooth transition similar to smooth zoom _update_view_states(false) var parchment_mapmode : bool = GameSingleton.is_parchment_mapmode_allowed() and _is_parchment_view - _map_shader_material.set_shader_parameter(GameLoader.ShaderManager.param_parchment_mix, float(parchment_mapmode)) + if _map_shader_material: + _map_shader_material.set_shader_parameter(GameLoader.ShaderManager.param_parchment_mix, float(parchment_mapmode)) func _update_orientation() -> void: const up := Vector3(0, 0, -1)