aboutsummaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-11 00:26:00 +0200
committer Hop311 <hop3114@gmail.com>2023-05-11 00:54:24 +0200
commit9ed9ee209ef9accebb9ec0d81ec58b569d680b6a (patch)
tree3418feaa5be1a932d84fd2f9c71280b39f706031 /extension
parentf3bcc10f06ed9aebd281df7851045b0247113e19 (diff)
Fix building buttons and terrain texture imports
Diffstat (limited to 'extension')
m---------extension/deps/openvic2-simulation0
-rw-r--r--extension/src/GameSingleton.cpp14
2 files changed, 8 insertions, 6 deletions
diff --git a/extension/deps/openvic2-simulation b/extension/deps/openvic2-simulation
-Subproject 3550c455526eb6f8935f488810e73fe01a1177a
+Subproject 339e0278a2064f7eeb152fe8c5778840b609e9f
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) {