From 9ed9ee209ef9accebb9ec0d81ec58b569d680b6a Mon Sep 17 00:00:00 2001 From: Hop311 Date: Wed, 10 May 2023 23:26:00 +0100 Subject: Fix building buttons and terrain texture imports --- extension/deps/openvic2-simulation | 2 +- extension/src/GameSingleton.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'extension') diff --git a/extension/deps/openvic2-simulation b/extension/deps/openvic2-simulation index 3550c45..339e027 160000 --- a/extension/deps/openvic2-simulation +++ b/extension/deps/openvic2-simulation @@ -1 +1 @@ -Subproject commit 3550c455526eb6f8935f488810e73fe01a1177a9 +Subproject commit 339e0278a2064f7eeb152fe8c5778840b609e9f3 diff --git a/extension/src/GameSingleton.cpp b/extension/src/GameSingleton.cpp index 44bf874..882bfcf 100644 --- a/extension/src/GameSingleton.cpp +++ b/extension/src/GameSingleton.cpp @@ -313,12 +313,15 @@ Error GameSingleton::_parse_terrain_entry(String const& identifier, Variant cons } Error GameSingleton::load_terrain_variant_file(String const& file_path) { - Error parse_err = _parse_json_dictionary_file("terrain variants", file_path, "", + const Error err = _parse_json_dictionary_file("terrain variants", file_path, "", [this](String const& identifier, Variant const& entry) -> Error { return _parse_terrain_entry(identifier, entry); }); terrain_variants.lock(); - if (terrain_variants.get_item_count() == 0) parse_err = FAILED; + if (err != OK || terrain_variants.get_item_count() == 0) { + UtilityFunctions::push_error("Failed to load terrain textures!"); + return FAILED; + } Array terrain_images; for (TerrainVariant const& var : terrain_variants.get_items()) { @@ -327,12 +330,11 @@ Error GameSingleton::load_terrain_variant_file(String const& file_path) { } terrain_texture.instantiate(); - const Error texturearray_err = terrain_texture->create_from_images(terrain_images); - if (texturearray_err != OK) { + if (terrain_texture->create_from_images(terrain_images) != OK) { UtilityFunctions::push_error("Failed to create terrain texture array!"); - return texturearray_err; + return FAILED; } - return parse_err; + return OK; } Error GameSingleton::load_map_images(String const& province_image_path, String const& terrain_image_path) { -- cgit v1.2.3-56-ga3b1