diff options
68 files changed, 762 insertions, 125 deletions
diff --git a/extension/src/LoadGameCompatibility.cpp b/extension/src/LoadGameCompatibility.cpp index 96c165b..ddde5b8 100644 --- a/extension/src/LoadGameCompatibility.cpp +++ b/extension/src/LoadGameCompatibility.cpp @@ -88,9 +88,8 @@ Error GameSingleton::_load_terrain_variants_compatibility_mode(String const& ter } // Load the terrain texture sheet and prepare to slice it up - Ref<Image> terrain_sheet; - terrain_sheet.instantiate(); - if (terrain_sheet->load(terrain_texturesheet_path) != OK) { + Ref<Image> terrain_sheet = load_godot_image(terrain_texturesheet_path); + if (terrain_sheet.is_null()) { UtilityFunctions::push_error("Failed to load terrain texture sheet: ", terrain_texturesheet_path); return FAILED; } diff --git a/extension/src/LoadGameOpenVic.cpp b/extension/src/LoadGameOpenVic.cpp index f856fd6..27fb265 100644 --- a/extension/src/LoadGameOpenVic.cpp +++ b/extension/src/LoadGameOpenVic.cpp @@ -19,14 +19,15 @@ static Error _load_json_file(String const& file_description, String const& file_ return err == OK ? FAILED : err; } const String json_string = file->get_as_text(); - JSON json; - err = json.parse(json_string); + Ref<JSON> json; + json.instantiate(); + err = json->parse(json_string); if (err != OK) { UtilityFunctions::push_error("Failed to parse ", file_description, " file as JSON: ", file_path, - "\nError at line ", json.get_error_line(), ": ", json.get_error_message()); + "\nError at line ", json->get_error_line(), ": ", json->get_error_message()); return err; } - result = json.get_data(); + result = json->get_data(); return err; } @@ -175,12 +176,10 @@ Error GameSingleton::_parse_terrain_entry(String const& identifier, Variant cons return FAILED; } const String terrain_path = terrain_texture_dir_path + identifier; - Ref<Image> terrain_image; - terrain_image.instantiate(); - const Error err = terrain_image->load(terrain_path); - if (err != OK) { + const Ref<Image> terrain_image = load_godot_image(terrain_path); + if (terrain_image.is_null()) { UtilityFunctions::push_error("Failed to load terrain image: ", terrain_path); - return err; + return FAILED; } return ERR(terrain_variants.add_item({ godot_to_std_string(identifier), colour, terrain_image })); } @@ -229,18 +228,15 @@ Error GameSingleton::_load_map_images(String const& province_image_path, String } // Load images - Ref<Image> province_image, terrain_image; - province_image.instantiate(); - terrain_image.instantiate(); - Error err = province_image->load(province_image_path); - if (err != OK) { + Ref<Image> province_image = load_godot_image(province_image_path); + if (province_image.is_null()) { UtilityFunctions::push_error("Failed to load province image: ", province_image_path); - return err; + return FAILED; } - err = terrain_image->load(terrain_image_path); - if (err != OK) { + Ref<Image> terrain_image = load_godot_image(terrain_image_path); + if (terrain_image.is_null()) { UtilityFunctions::push_error("Failed to load terrain image: ", terrain_image_path); - return err; + return FAILED; } if (flip_vertical) { @@ -249,6 +245,7 @@ Error GameSingleton::_load_map_images(String const& province_image_path, String } // Validate dimensions and format + Error err = OK; const Vector2i province_dims = province_image->get_size(), terrain_dims = terrain_image->get_size(); if (province_dims.x < 1 || province_dims.y < 1) { UtilityFunctions::push_error("Invalid dimensions (", province_dims.x, "x", province_dims.y, ") for province image: ", province_image_path); @@ -378,16 +375,14 @@ Error GameSingleton::_load_goods(String const& defines_path, String const& icons }); game_manager.good_manager.lock_goods(); for (Good const& good : game_manager.good_manager.get_goods()) { - Ref<Image> image; - image.instantiate(); const String path = icons_dir_path + String { "/" } + std_to_godot_string(good.get_identifier()) + ".png"; - const Error good_err = image->load(path); - if (good_err || image.is_null()) { + const Ref<Image> image = load_godot_image(path); + if (image.is_null()) { UtilityFunctions::push_error("Failed to load good icon image: ", path); err = FAILED; continue; } - Ref<Texture> tex = ImageTexture::create_from_image(image); + const Ref<Texture> tex = ImageTexture::create_from_image(image); if (tex.is_null()) { UtilityFunctions::push_error("Failed to generate good icon texture: ", path); err = FAILED; diff --git a/extension/src/Utilities.cpp b/extension/src/Utilities.cpp new file mode 100644 index 0000000..a912490 --- /dev/null +++ b/extension/src/Utilities.cpp @@ -0,0 +1,16 @@ +#include "Utilities.hpp" + +#include <godot_cpp/classes/resource_loader.hpp> +#include <godot_cpp/variant/utility_functions.hpp> + +using namespace godot; +using namespace OpenVic; + +Ref<Image> OpenVic::load_godot_image(String const& path) { + if (path.begins_with("res://")) { + ResourceLoader* loader = ResourceLoader::get_singleton(); + return loader ? loader->load(path) : nullptr; + } else { + return Image::load_from_file(path); + } +} diff --git a/extension/src/Utilities.hpp b/extension/src/Utilities.hpp index 75e873f..681b893 100644 --- a/extension/src/Utilities.hpp +++ b/extension/src/Utilities.hpp @@ -1,6 +1,6 @@ #pragma once -#include <godot_cpp/variant/string.hpp> +#include <godot_cpp/classes/image.hpp> #include "openvic/Types.hpp" @@ -15,4 +15,6 @@ namespace OpenVic { inline godot::String std_to_godot_string(std::string const& str) { return str.c_str(); } + + godot::Ref<godot::Image> load_godot_image(godot::String const& path); } diff --git a/game/art/economy/goods/good_aeroplanes.png.import b/game/art/economy/goods/good_aeroplanes.png.import index 8dd0c09..4bb023c 100644 --- a/game/art/economy/goods/good_aeroplanes.png.import +++ b/game/art/economy/goods/good_aeroplanes.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://b1kuq7k8prdc5" +path="res://.godot/imported/good_aeroplanes.png-7a57a10fe765bbdfb738ac1b788a0a02.image" + +[deps] + +source_file="res://art/economy/goods/good_aeroplanes.png" +dest_files=["res://.godot/imported/good_aeroplanes.png-7a57a10fe765bbdfb738ac1b788a0a02.image"] + +[params] + diff --git a/game/art/economy/goods/good_ammunition.png.import b/game/art/economy/goods/good_ammunition.png.import index 8dd0c09..a5e95aa 100644 --- a/game/art/economy/goods/good_ammunition.png.import +++ b/game/art/economy/goods/good_ammunition.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://mdsbfb1kx2yr" +path="res://.godot/imported/good_ammunition.png-ab17c8b5b6f699fce3dd4d8842555fcc.image" + +[deps] + +source_file="res://art/economy/goods/good_ammunition.png" +dest_files=["res://.godot/imported/good_ammunition.png-ab17c8b5b6f699fce3dd4d8842555fcc.image"] + +[params] + diff --git a/game/art/economy/goods/good_artillery.png.import b/game/art/economy/goods/good_artillery.png.import index 8dd0c09..3f06a9b 100644 --- a/game/art/economy/goods/good_artillery.png.import +++ b/game/art/economy/goods/good_artillery.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://bao8gdl5pjr3l" +path="res://.godot/imported/good_artillery.png-ccb7bdbd694b82b7887edc5e918f891c.image" + +[deps] + +source_file="res://art/economy/goods/good_artillery.png" +dest_files=["res://.godot/imported/good_artillery.png-ccb7bdbd694b82b7887edc5e918f891c.image"] + +[params] + diff --git a/game/art/economy/goods/good_automobiles.png.import b/game/art/economy/goods/good_automobiles.png.import index 8dd0c09..f83da06 100644 --- a/game/art/economy/goods/good_automobiles.png.import +++ b/game/art/economy/goods/good_automobiles.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://cbgodumv1urxc" +path="res://.godot/imported/good_automobiles.png-e7135793fbe9163a9843b57ef1cc9b26.image" + +[deps] + +source_file="res://art/economy/goods/good_automobiles.png" +dest_files=["res://.godot/imported/good_automobiles.png-e7135793fbe9163a9843b57ef1cc9b26.image"] + +[params] + diff --git a/game/art/economy/goods/good_canned_food.png.import b/game/art/economy/goods/good_canned_food.png.import index 8dd0c09..bc1c2c7 100644 --- a/game/art/economy/goods/good_canned_food.png.import +++ b/game/art/economy/goods/good_canned_food.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://1uru8eufge1w" +path="res://.godot/imported/good_canned_food.png-c83bafca536c627868b367290d5be590.image" + +[deps] + +source_file="res://art/economy/goods/good_canned_food.png" +dest_files=["res://.godot/imported/good_canned_food.png-c83bafca536c627868b367290d5be590.image"] + +[params] + diff --git a/game/art/economy/goods/good_cattle.png.import b/game/art/economy/goods/good_cattle.png.import index 8dd0c09..34a4aa5 100644 --- a/game/art/economy/goods/good_cattle.png.import +++ b/game/art/economy/goods/good_cattle.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://gkjpiul6248l" +path="res://.godot/imported/good_cattle.png-089bb1aba8f91888c577c6cb83992c61.image" + +[deps] + +source_file="res://art/economy/goods/good_cattle.png" +dest_files=["res://.godot/imported/good_cattle.png-089bb1aba8f91888c577c6cb83992c61.image"] + +[params] + diff --git a/game/art/economy/goods/good_cement.png.import b/game/art/economy/goods/good_cement.png.import index 8dd0c09..5b9015b 100644 --- a/game/art/economy/goods/good_cement.png.import +++ b/game/art/economy/goods/good_cement.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://cyvflc8knuia3" +path="res://.godot/imported/good_cement.png-0a1e1f3c8aaf7c59a8fcac3864c43060.image" + +[deps] + +source_file="res://art/economy/goods/good_cement.png" +dest_files=["res://.godot/imported/good_cement.png-0a1e1f3c8aaf7c59a8fcac3864c43060.image"] + +[params] + diff --git a/game/art/economy/goods/good_clipper_convoys.png.import b/game/art/economy/goods/good_clipper_convoys.png.import index 8dd0c09..e07cfd4 100644 --- a/game/art/economy/goods/good_clipper_convoys.png.import +++ b/game/art/economy/goods/good_clipper_convoys.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://7n6cw4q6cpg0" +path="res://.godot/imported/good_clipper_convoys.png-f65ae0524e341c14756b9715ac19e959.image" + +[deps] + +source_file="res://art/economy/goods/good_clipper_convoys.png" +dest_files=["res://.godot/imported/good_clipper_convoys.png-f65ae0524e341c14756b9715ac19e959.image"] + +[params] + diff --git a/game/art/economy/goods/good_coal.png.import b/game/art/economy/goods/good_coal.png.import index 8dd0c09..0ffbf32 100644 --- a/game/art/economy/goods/good_coal.png.import +++ b/game/art/economy/goods/good_coal.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dlqk1fobuy2pd" +path="res://.godot/imported/good_coal.png-dd9ac68e2f68640bcc4557fcbaf0b3da.image" + +[deps] + +source_file="res://art/economy/goods/good_coal.png" +dest_files=["res://.godot/imported/good_coal.png-dd9ac68e2f68640bcc4557fcbaf0b3da.image"] + +[params] + diff --git a/game/art/economy/goods/good_coffee.png.import b/game/art/economy/goods/good_coffee.png.import index 8dd0c09..b33b7ce 100644 --- a/game/art/economy/goods/good_coffee.png.import +++ b/game/art/economy/goods/good_coffee.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://3jy5uu2jq2pr" +path="res://.godot/imported/good_coffee.png-7768b17964b43493a389f99a279f24ee.image" + +[deps] + +source_file="res://art/economy/goods/good_coffee.png" +dest_files=["res://.godot/imported/good_coffee.png-7768b17964b43493a389f99a279f24ee.image"] + +[params] + diff --git a/game/art/economy/goods/good_cotton.png.import b/game/art/economy/goods/good_cotton.png.import index 8dd0c09..0b4a6f9 100644 --- a/game/art/economy/goods/good_cotton.png.import +++ b/game/art/economy/goods/good_cotton.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://qowksfvibsaj" +path="res://.godot/imported/good_cotton.png-1be24dab75d5d55dfd628720de8fa9b4.image" + +[deps] + +source_file="res://art/economy/goods/good_cotton.png" +dest_files=["res://.godot/imported/good_cotton.png-1be24dab75d5d55dfd628720de8fa9b4.image"] + +[params] + diff --git a/game/art/economy/goods/good_dye.png.import b/game/art/economy/goods/good_dye.png.import index 8dd0c09..ba8ac1a 100644 --- a/game/art/economy/goods/good_dye.png.import +++ b/game/art/economy/goods/good_dye.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://c0olvg2dwe6nt" +path="res://.godot/imported/good_dye.png-3860e12c1400e31fe7cef3cebea7d9c8.image" + +[deps] + +source_file="res://art/economy/goods/good_dye.png" +dest_files=["res://.godot/imported/good_dye.png-3860e12c1400e31fe7cef3cebea7d9c8.image"] + +[params] + diff --git a/game/art/economy/goods/good_electric_gears.png.import b/game/art/economy/goods/good_electric_gears.png.import index 8dd0c09..d35841c 100644 --- a/game/art/economy/goods/good_electric_gears.png.import +++ b/game/art/economy/goods/good_electric_gears.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://ddv56dq6f14ct" +path="res://.godot/imported/good_electric_gears.png-3cfff1f338b9a904a6fd956041eae0e7.image" + +[deps] + +source_file="res://art/economy/goods/good_electric_gears.png" +dest_files=["res://.godot/imported/good_electric_gears.png-3cfff1f338b9a904a6fd956041eae0e7.image"] + +[params] + diff --git a/game/art/economy/goods/good_explosives.png.import b/game/art/economy/goods/good_explosives.png.import index 8dd0c09..6ed32a7 100644 --- a/game/art/economy/goods/good_explosives.png.import +++ b/game/art/economy/goods/good_explosives.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://b08wotf623gt1" +path="res://.godot/imported/good_explosives.png-a66d3b6c0368d11d0a481ad963f9a327.image" + +[deps] + +source_file="res://art/economy/goods/good_explosives.png" +dest_files=["res://.godot/imported/good_explosives.png-a66d3b6c0368d11d0a481ad963f9a327.image"] + +[params] + diff --git a/game/art/economy/goods/good_fabric.png.import b/game/art/economy/goods/good_fabric.png.import index 8dd0c09..4726cd3 100644 --- a/game/art/economy/goods/good_fabric.png.import +++ b/game/art/economy/goods/good_fabric.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dkdoce38sued1" +path="res://.godot/imported/good_fabric.png-cae92ac8cdf54dfb1030c828b822b10c.image" + +[deps] + +source_file="res://art/economy/goods/good_fabric.png" +dest_files=["res://.godot/imported/good_fabric.png-cae92ac8cdf54dfb1030c828b822b10c.image"] + +[params] + diff --git a/game/art/economy/goods/good_fertilizer.png.import b/game/art/economy/goods/good_fertilizer.png.import index 8dd0c09..e91f4b3 100644 --- a/game/art/economy/goods/good_fertilizer.png.import +++ b/game/art/economy/goods/good_fertilizer.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://b8cca7k8p7ix4" +path="res://.godot/imported/good_fertilizer.png-dc4654b14c0533f03b171c40b4c9fd0a.image" + +[deps] + +source_file="res://art/economy/goods/good_fertilizer.png" +dest_files=["res://.godot/imported/good_fertilizer.png-dc4654b14c0533f03b171c40b4c9fd0a.image"] + +[params] + diff --git a/game/art/economy/goods/good_fish.png.import b/game/art/economy/goods/good_fish.png.import index 8dd0c09..9e11091 100644 --- a/game/art/economy/goods/good_fish.png.import +++ b/game/art/economy/goods/good_fish.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dngxh4ai77636" +path="res://.godot/imported/good_fish.png-b121aa8c24a6034978a21e30aa911543.image" + +[deps] + +source_file="res://art/economy/goods/good_fish.png" +dest_files=["res://.godot/imported/good_fish.png-b121aa8c24a6034978a21e30aa911543.image"] + +[params] + diff --git a/game/art/economy/goods/good_fruit.png.import b/game/art/economy/goods/good_fruit.png.import index 8dd0c09..38182e9 100644 --- a/game/art/economy/goods/good_fruit.png.import +++ b/game/art/economy/goods/good_fruit.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://mhymob78sc66" +path="res://.godot/imported/good_fruit.png-d243f420031becbe4fde831f75d8775d.image" + +[deps] + +source_file="res://art/economy/goods/good_fruit.png" +dest_files=["res://.godot/imported/good_fruit.png-d243f420031becbe4fde831f75d8775d.image"] + +[params] + diff --git a/game/art/economy/goods/good_fuel.png.import b/game/art/economy/goods/good_fuel.png.import index 8dd0c09..fd7e4f0 100644 --- a/game/art/economy/goods/good_fuel.png.import +++ b/game/art/economy/goods/good_fuel.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://io6akve2mmoq" +path="res://.godot/imported/good_fuel.png-2109b0ff91e60a0493aae55e62af5d60.image" + +[deps] + +source_file="res://art/economy/goods/good_fuel.png" +dest_files=["res://.godot/imported/good_fuel.png-2109b0ff91e60a0493aae55e62af5d60.image"] + +[params] + diff --git a/game/art/economy/goods/good_furniture.png.import b/game/art/economy/goods/good_furniture.png.import index 8dd0c09..2102079 100644 --- a/game/art/economy/goods/good_furniture.png.import +++ b/game/art/economy/goods/good_furniture.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://5ri2aw6okdnf" +path="res://.godot/imported/good_furniture.png-1adf5a4de61619dcbfb263bbd777fe6c.image" + +[deps] + +source_file="res://art/economy/goods/good_furniture.png" +dest_files=["res://.godot/imported/good_furniture.png-1adf5a4de61619dcbfb263bbd777fe6c.image"] + +[params] + diff --git a/game/art/economy/goods/good_glass.png.import b/game/art/economy/goods/good_glass.png.import index 8dd0c09..2b7b6f8 100644 --- a/game/art/economy/goods/good_glass.png.import +++ b/game/art/economy/goods/good_glass.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://c8ee8mt7d18xn" +path="res://.godot/imported/good_glass.png-c295705ce9a627d363e1ca2001dde23a.image" + +[deps] + +source_file="res://art/economy/goods/good_glass.png" +dest_files=["res://.godot/imported/good_glass.png-c295705ce9a627d363e1ca2001dde23a.image"] + +[params] + diff --git a/game/art/economy/goods/good_grain.png.import b/game/art/economy/goods/good_grain.png.import index 8dd0c09..e0dfd07 100644 --- a/game/art/economy/goods/good_grain.png.import +++ b/game/art/economy/goods/good_grain.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://05vujlayrahi" +path="res://.godot/imported/good_grain.png-811eb0de77edb0e4e86191526fe884b5.image" + +[deps] + +source_file="res://art/economy/goods/good_grain.png" +dest_files=["res://.godot/imported/good_grain.png-811eb0de77edb0e4e86191526fe884b5.image"] + +[params] + diff --git a/game/art/economy/goods/good_iron.png.import b/game/art/economy/goods/good_iron.png.import index 8dd0c09..c4efa99 100644 --- a/game/art/economy/goods/good_iron.png.import +++ b/game/art/economy/goods/good_iron.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dahscanxyagx7" +path="res://.godot/imported/good_iron.png-7b28cebcb055d7448bc57fcd496889f7.image" + +[deps] + +source_file="res://art/economy/goods/good_iron.png" +dest_files=["res://.godot/imported/good_iron.png-7b28cebcb055d7448bc57fcd496889f7.image"] + +[params] + diff --git a/game/art/economy/goods/good_liquor.png.import b/game/art/economy/goods/good_liquor.png.import index 8dd0c09..d6182bc 100644 --- a/game/art/economy/goods/good_liquor.png.import +++ b/game/art/economy/goods/good_liquor.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dialradcphprc" +path="res://.godot/imported/good_liquor.png-7562889384c3b4920fdcf6ef317ef1c3.image" + +[deps] + +source_file="res://art/economy/goods/good_liquor.png" +dest_files=["res://.godot/imported/good_liquor.png-7562889384c3b4920fdcf6ef317ef1c3.image"] + +[params] + diff --git a/game/art/economy/goods/good_lumber.png.import b/game/art/economy/goods/good_lumber.png.import index 8dd0c09..e2d18bf 100644 --- a/game/art/economy/goods/good_lumber.png.import +++ b/game/art/economy/goods/good_lumber.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://n5q7vatwb7vy" +path="res://.godot/imported/good_lumber.png-a89989392579e428c522561c7791aa8a.image" + +[deps] + +source_file="res://art/economy/goods/good_lumber.png" +dest_files=["res://.godot/imported/good_lumber.png-a89989392579e428c522561c7791aa8a.image"] + +[params] + diff --git a/game/art/economy/goods/good_luxury_clothes.png.import b/game/art/economy/goods/good_luxury_clothes.png.import index 8dd0c09..07542d4 100644 --- a/game/art/economy/goods/good_luxury_clothes.png.import +++ b/game/art/economy/goods/good_luxury_clothes.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dgl52m0j7j8gk" +path="res://.godot/imported/good_luxury_clothes.png-c1de34ca95f4fbd6359cbc7b8e50dc53.image" + +[deps] + +source_file="res://art/economy/goods/good_luxury_clothes.png" +dest_files=["res://.godot/imported/good_luxury_clothes.png-c1de34ca95f4fbd6359cbc7b8e50dc53.image"] + +[params] + diff --git a/game/art/economy/goods/good_luxury_furniture.png.import b/game/art/economy/goods/good_luxury_furniture.png.import index 8dd0c09..079ed83 100644 --- a/game/art/economy/goods/good_luxury_furniture.png.import +++ b/game/art/economy/goods/good_luxury_furniture.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://cwa4cp7rw52se" +path="res://.godot/imported/good_luxury_furniture.png-775415357561e5fd19efde9571063447.image" + +[deps] + +source_file="res://art/economy/goods/good_luxury_furniture.png" +dest_files=["res://.godot/imported/good_luxury_furniture.png-775415357561e5fd19efde9571063447.image"] + +[params] + diff --git a/game/art/economy/goods/good_machine_parts.png.import b/game/art/economy/goods/good_machine_parts.png.import index 8dd0c09..bab3652 100644 --- a/game/art/economy/goods/good_machine_parts.png.import +++ b/game/art/economy/goods/good_machine_parts.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://grn8ijhdoh1o" +path="res://.godot/imported/good_machine_parts.png-93ac404571481e2cf14b4227f7a1bc65.image" + +[deps] + +source_file="res://art/economy/goods/good_machine_parts.png" +dest_files=["res://.godot/imported/good_machine_parts.png-93ac404571481e2cf14b4227f7a1bc65.image"] + +[params] + diff --git a/game/art/economy/goods/good_oil.png.import b/game/art/economy/goods/good_oil.png.import index 8dd0c09..1c7ee64 100644 --- a/game/art/economy/goods/good_oil.png.import +++ b/game/art/economy/goods/good_oil.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://blgngx1k43uww" +path="res://.godot/imported/good_oil.png-9671b03425abaa4486f2531ff41d265b.image" + +[deps] + +source_file="res://art/economy/goods/good_oil.png" +dest_files=["res://.godot/imported/good_oil.png-9671b03425abaa4486f2531ff41d265b.image"] + +[params] + diff --git a/game/art/economy/goods/good_opium.png.import b/game/art/economy/goods/good_opium.png.import index 8dd0c09..59c6a85 100644 --- a/game/art/economy/goods/good_opium.png.import +++ b/game/art/economy/goods/good_opium.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dg8hopeslcvu5" +path="res://.godot/imported/good_opium.png-6341d8aeba9efb1a0a97a7c5400a3e80.image" + +[deps] + +source_file="res://art/economy/goods/good_opium.png" +dest_files=["res://.godot/imported/good_opium.png-6341d8aeba9efb1a0a97a7c5400a3e80.image"] + +[params] + diff --git a/game/art/economy/goods/good_paper.png.import b/game/art/economy/goods/good_paper.png.import index 8dd0c09..c6e7464 100644 --- a/game/art/economy/goods/good_paper.png.import +++ b/game/art/economy/goods/good_paper.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://d1bqv45m8r4bh" +path="res://.godot/imported/good_paper.png-0a5e24fbad019a4e71441aa1f1d6fed4.image" + +[deps] + +source_file="res://art/economy/goods/good_paper.png" +dest_files=["res://.godot/imported/good_paper.png-0a5e24fbad019a4e71441aa1f1d6fed4.image"] + +[params] + diff --git a/game/art/economy/goods/good_precious_metal.png.import b/game/art/economy/goods/good_precious_metal.png.import index 8dd0c09..0c2dc5b 100644 --- a/game/art/economy/goods/good_precious_metal.png.import +++ b/game/art/economy/goods/good_precious_metal.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://bxa2c6smyh6m4" +path="res://.godot/imported/good_precious_metal.png-70cb259662b364ed8685a3e5344d25f8.image" + +[deps] + +source_file="res://art/economy/goods/good_precious_metal.png" +dest_files=["res://.godot/imported/good_precious_metal.png-70cb259662b364ed8685a3e5344d25f8.image"] + +[params] + diff --git a/game/art/economy/goods/good_radios.png.import b/game/art/economy/goods/good_radios.png.import index 8dd0c09..9f313e6 100644 --- a/game/art/economy/goods/good_radios.png.import +++ b/game/art/economy/goods/good_radios.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://6a6ds8n4i11f" +path="res://.godot/imported/good_radios.png-c89ffd8a134e15da3796a8d2e3a45da6.image" + +[deps] + +source_file="res://art/economy/goods/good_radios.png" +dest_files=["res://.godot/imported/good_radios.png-c89ffd8a134e15da3796a8d2e3a45da6.image"] + +[params] + diff --git a/game/art/economy/goods/good_regular_clothes.png.import b/game/art/economy/goods/good_regular_clothes.png.import index 8dd0c09..0730d7a 100644 --- a/game/art/economy/goods/good_regular_clothes.png.import +++ b/game/art/economy/goods/good_regular_clothes.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://cyyjk8jki0c1k" +path="res://.godot/imported/good_regular_clothes.png-e5e0e3499731529e3240bd5b4aceb543.image" + +[deps] + +source_file="res://art/economy/goods/good_regular_clothes.png" +dest_files=["res://.godot/imported/good_regular_clothes.png-e5e0e3499731529e3240bd5b4aceb543.image"] + +[params] + diff --git a/game/art/economy/goods/good_rubber.png.import b/game/art/economy/goods/good_rubber.png.import index 8dd0c09..c5d6e6b 100644 --- a/game/art/economy/goods/good_rubber.png.import +++ b/game/art/economy/goods/good_rubber.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://6d3hi21re7vu" +path="res://.godot/imported/good_rubber.png-80a5757539b9a9b429e7c78c60e2430a.image" + +[deps] + +source_file="res://art/economy/goods/good_rubber.png" +dest_files=["res://.godot/imported/good_rubber.png-80a5757539b9a9b429e7c78c60e2430a.image"] + +[params] + diff --git a/game/art/economy/goods/good_silk.png.import b/game/art/economy/goods/good_silk.png.import index 8dd0c09..6014317 100644 --- a/game/art/economy/goods/good_silk.png.import +++ b/game/art/economy/goods/good_silk.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://cl4cedysbxpi3" +path="res://.godot/imported/good_silk.png-73e35b9d9d3b0a168d03c35b97091b20.image" + +[deps] + +source_file="res://art/economy/goods/good_silk.png" +dest_files=["res://.godot/imported/good_silk.png-73e35b9d9d3b0a168d03c35b97091b20.image"] + +[params] + diff --git a/game/art/economy/goods/good_small_arms.png.import b/game/art/economy/goods/good_small_arms.png.import index 8dd0c09..90f26fb 100644 --- a/game/art/economy/goods/good_small_arms.png.import +++ b/game/art/economy/goods/good_small_arms.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://bem3ej8ele0qr" +path="res://.godot/imported/good_small_arms.png-ab6a1cff543e96684bb64337b5d81d9e.image" + +[deps] + +source_file="res://art/economy/goods/good_small_arms.png" +dest_files=["res://.godot/imported/good_small_arms.png-ab6a1cff543e96684bb64337b5d81d9e.image"] + +[params] + diff --git a/game/art/economy/goods/good_steamer_convoys.png.import b/game/art/economy/goods/good_steamer_convoys.png.import index 8dd0c09..90b5d53 100644 --- a/game/art/economy/goods/good_steamer_convoys.png.import +++ b/game/art/economy/goods/good_steamer_convoys.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dwiw10uxdqq3h" +path="res://.godot/imported/good_steamer_convoys.png-53cc329d4c29c6e2538c3c4356a67c39.image" + +[deps] + +source_file="res://art/economy/goods/good_steamer_convoys.png" +dest_files=["res://.godot/imported/good_steamer_convoys.png-53cc329d4c29c6e2538c3c4356a67c39.image"] + +[params] + diff --git a/game/art/economy/goods/good_steel.png.import b/game/art/economy/goods/good_steel.png.import index 8dd0c09..6a5b967 100644 --- a/game/art/economy/goods/good_steel.png.import +++ b/game/art/economy/goods/good_steel.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://d5yfj0lreiix" +path="res://.godot/imported/good_steel.png-d26fd1ae635591a88191df8360c4a3a3.image" + +[deps] + +source_file="res://art/economy/goods/good_steel.png" +dest_files=["res://.godot/imported/good_steel.png-d26fd1ae635591a88191df8360c4a3a3.image"] + +[params] + diff --git a/game/art/economy/goods/good_sulphur.png.import b/game/art/economy/goods/good_sulphur.png.import index 8dd0c09..1480ad9 100644 --- a/game/art/economy/goods/good_sulphur.png.import +++ b/game/art/economy/goods/good_sulphur.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://pil6cifo50ct" +path="res://.godot/imported/good_sulphur.png-2ae7d484191682b90b52d0946f580557.image" + +[deps] + +source_file="res://art/economy/goods/good_sulphur.png" +dest_files=["res://.godot/imported/good_sulphur.png-2ae7d484191682b90b52d0946f580557.image"] + +[params] + diff --git a/game/art/economy/goods/good_tanks.png.import b/game/art/economy/goods/good_tanks.png.import index 8dd0c09..ded8b0d 100644 --- a/game/art/economy/goods/good_tanks.png.import +++ b/game/art/economy/goods/good_tanks.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dobrrmagml05w" +path="res://.godot/imported/good_tanks.png-33bf353399e9db6f61d804a1976ca3d5.image" + +[deps] + +source_file="res://art/economy/goods/good_tanks.png" +dest_files=["res://.godot/imported/good_tanks.png-33bf353399e9db6f61d804a1976ca3d5.image"] + +[params] + diff --git a/game/art/economy/goods/good_tea.png.import b/game/art/economy/goods/good_tea.png.import index 8dd0c09..c1b681b 100644 --- a/game/art/economy/goods/good_tea.png.import +++ b/game/art/economy/goods/good_tea.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://bcjeglnlrolb4" +path="res://.godot/imported/good_tea.png-24cd982e5dd7512fb494d815ec5f5b8c.image" + +[deps] + +source_file="res://art/economy/goods/good_tea.png" +dest_files=["res://.godot/imported/good_tea.png-24cd982e5dd7512fb494d815ec5f5b8c.image"] + +[params] + diff --git a/game/art/economy/goods/good_telephones.png.import b/game/art/economy/goods/good_telephones.png.import index 8dd0c09..90b0b51 100644 --- a/game/art/economy/goods/good_telephones.png.import +++ b/game/art/economy/goods/good_telephones.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://ci1urs3l8jng1" +path="res://.godot/imported/good_telephones.png-13562dd5561459abce209f92025e518f.image" + +[deps] + +source_file="res://art/economy/goods/good_telephones.png" +dest_files=["res://.godot/imported/good_telephones.png-13562dd5561459abce209f92025e518f.image"] + +[params] + diff --git a/game/art/economy/goods/good_timber.png.import b/game/art/economy/goods/good_timber.png.import index 8dd0c09..311c817 100644 --- a/game/art/economy/goods/good_timber.png.import +++ b/game/art/economy/goods/good_timber.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://cepfiiuvclo6v" +path="res://.godot/imported/good_timber.png-8972ab65fa6d80aa6aa38501c49adde6.image" + +[deps] + +source_file="res://art/economy/goods/good_timber.png" +dest_files=["res://.godot/imported/good_timber.png-8972ab65fa6d80aa6aa38501c49adde6.image"] + +[params] + diff --git a/game/art/economy/goods/good_tobacco.png.import b/game/art/economy/goods/good_tobacco.png.import index 8dd0c09..4565a1b 100644 --- a/game/art/economy/goods/good_tobacco.png.import +++ b/game/art/economy/goods/good_tobacco.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://kcaksf7cmwty" +path="res://.godot/imported/good_tobacco.png-b0daa3923eeb65380e27694227c28463.image" + +[deps] + +source_file="res://art/economy/goods/good_tobacco.png" +dest_files=["res://.godot/imported/good_tobacco.png-b0daa3923eeb65380e27694227c28463.image"] + +[params] + diff --git a/game/art/economy/goods/good_tropical_wood.png.import b/game/art/economy/goods/good_tropical_wood.png.import index 8dd0c09..97f2458 100644 --- a/game/art/economy/goods/good_tropical_wood.png.import +++ b/game/art/economy/goods/good_tropical_wood.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://pxi8v6bqsmn2" +path="res://.godot/imported/good_tropical_wood.png-227a307b3f13efd1924da53194d4b1f7.image" + +[deps] + +source_file="res://art/economy/goods/good_tropical_wood.png" +dest_files=["res://.godot/imported/good_tropical_wood.png-227a307b3f13efd1924da53194d4b1f7.image"] + +[params] + diff --git a/game/art/economy/goods/good_wine.png.import b/game/art/economy/goods/good_wine.png.import index 8dd0c09..335cb00 100644 --- a/game/art/economy/goods/good_wine.png.import +++ b/game/art/economy/goods/good_wine.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dfh6rux8hrly5" +path="res://.godot/imported/good_wine.png-6bfb1d83a0cd9e755399ce4ce576edae.image" + +[deps] + +source_file="res://art/economy/goods/good_wine.png" +dest_files=["res://.godot/imported/good_wine.png-6bfb1d83a0cd9e755399ce4ce576edae.image"] + +[params] + diff --git a/game/art/economy/goods/good_wool.png.import b/game/art/economy/goods/good_wool.png.import index 8dd0c09..f6f5d69 100644 --- a/game/art/economy/goods/good_wool.png.import +++ b/game/art/economy/goods/good_wool.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://frnqx1u57djm" +path="res://.godot/imported/good_wool.png-6dba23c951e5cb3cc74ce81f890cf7e8.image" + +[deps] + +source_file="res://art/economy/goods/good_wool.png" +dest_files=["res://.godot/imported/good_wool.png-6dba23c951e5cb3cc74ce81f890cf7e8.image"] + +[params] + diff --git a/game/art/terrain/desert_rocky.png.import b/game/art/terrain/desert_rocky.png.import index 8dd0c09..258f6d4 100644 --- a/game/art/terrain/desert_rocky.png.import +++ b/game/art/terrain/desert_rocky.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://ketdtpxlpwti" +path="res://.godot/imported/desert_rocky.png-2c26845e144e1e8b9c55419654df6654.image" + +[deps] + +source_file="res://art/terrain/desert_rocky.png" +dest_files=["res://.godot/imported/desert_rocky.png-2c26845e144e1e8b9c55419654df6654.image"] + +[params] + diff --git a/game/art/terrain/desert_smooth.png.import b/game/art/terrain/desert_smooth.png.import index 8dd0c09..890bd4b 100644 --- a/game/art/terrain/desert_smooth.png.import +++ b/game/art/terrain/desert_smooth.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://d3fh2rgcv2do4" +path="res://.godot/imported/desert_smooth.png-58a5349b112e9e97cf3426b380f022ef.image" + +[deps] + +source_file="res://art/terrain/desert_smooth.png" +dest_files=["res://.godot/imported/desert_smooth.png-58a5349b112e9e97cf3426b380f022ef.image"] + +[params] + diff --git a/game/art/terrain/farmlands.png.import b/game/art/terrain/farmlands.png.import index 8dd0c09..898bb2a 100644 --- a/game/art/terrain/farmlands.png.import +++ b/game/art/terrain/farmlands.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://b4ra6msfwd8fd" +path="res://.godot/imported/farmlands.png-821213ab9dba19cea6f6c966b3a3760b.image" + +[deps] + +source_file="res://art/terrain/farmlands.png" +dest_files=["res://.godot/imported/farmlands.png-821213ab9dba19cea6f6c966b3a3760b.image"] + +[params] + diff --git a/game/art/terrain/mountains.png.import b/game/art/terrain/mountains.png.import index 8dd0c09..e403b45 100644 --- a/game/art/terrain/mountains.png.import +++ b/game/art/terrain/mountains.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dnj50p7o03s3q" +path="res://.godot/imported/mountains.png-f1ab7d9b0a0deb485923c40b1cfb258e.image" + +[deps] + +source_file="res://art/terrain/mountains.png" +dest_files=["res://.godot/imported/mountains.png-f1ab7d9b0a0deb485923c40b1cfb258e.image"] + +[params] + diff --git a/game/art/terrain/ocean.png.import b/game/art/terrain/ocean.png.import index 8dd0c09..e72a174 100644 --- a/game/art/terrain/ocean.png.import +++ b/game/art/terrain/ocean.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://bvh4qt04mk8km" +path="res://.godot/imported/ocean.png-3d7e213c3fca805d033e0d3bf567fc01.image" + +[deps] + +source_file="res://art/terrain/ocean.png" +dest_files=["res://.godot/imported/ocean.png-3d7e213c3fca805d033e0d3bf567fc01.image"] + +[params] + diff --git a/game/common/map/provinces.png.import b/game/common/map/provinces.png.import index 8dd0c09..1e521e3 100644 --- a/game/common/map/provinces.png.import +++ b/game/common/map/provinces.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dlri3ubsvspku" +path="res://.godot/imported/provinces.png-ccb48ce493cb913f98015dfe13c030ff.image" + +[deps] + +source_file="res://common/map/provinces.png" +dest_files=["res://.godot/imported/provinces.png-ccb48ce493cb913f98015dfe13c030ff.image"] + +[params] + diff --git a/game/common/map/terrain.png.import b/game/common/map/terrain.png.import index 8dd0c09..dffdc93 100644 --- a/game/common/map/terrain.png.import +++ b/game/common/map/terrain.png.import @@ -1,3 +1,14 @@ [remap] -importer="keep" +importer="image" +type="Image" +uid="uid://dku2vjaty102l" +path="res://.godot/imported/terrain.png-d7b8d6bd02c5e028be54cfe630df9caa.image" + +[deps] + +source_file="res://common/map/terrain.png" +dest_files=["res://.godot/imported/terrain.png-d7b8d6bd02c5e028be54cfe630df9caa.image"] + +[params] + diff --git a/game/project.godot b/game/project.godot index 441001d..3bb2438 100644 --- a/game/project.godot +++ b/game/project.godot @@ -21,6 +21,7 @@ config/project_settings_override.template="user://settings.cfg" [autoload] +ArgumentParser="*res://src/Autoload/Arguments/ArgumentParser.tscn" Events="*res://src/Autoload/Events.gd" Resolution="*res://src/Autoload/Resolution.gd" SoundManager="*res://src/Autoload/SoundManager.gd" diff --git a/game/src/ArgumentParser.tscn b/game/src/ArgumentParser.tscn deleted file mode 100644 index 964c19e..0000000 --- a/game/src/ArgumentParser.tscn +++ /dev/null @@ -1,24 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://dayjmgc34tqo6"] - -[ext_resource type="Script" path="res://src/ArgumentParser.gd" id="1_8e7gi"] -[ext_resource type="Script" path="res://src/ArgumentOption.gd" id="2_f3c26"] - -[sub_resource type="Resource" id="Resource_tq3y4"] -script = ExtResource("2_f3c26") -name = &"help" -aliases = Array[StringName]([&"h"]) -type = 1 -description = "Displays help and quits." -default_value = false - -[sub_resource type="Resource" id="Resource_j1to4"] -script = ExtResource("2_f3c26") -name = &"game-debug" -aliases = Array[StringName]([&"d", &"-debug", &"-debug-mode"]) -type = 1 -description = "Start in debug mode." -default_value = false - -[node name="ArgumentParser" type="Node"] -script = ExtResource("1_8e7gi") -option_array = Array[ExtResource("2_f3c26")]([SubResource("Resource_tq3y4"), SubResource("Resource_j1to4")]) diff --git a/game/src/ArgumentOption.gd b/game/src/Autoload/Arguments/ArgumentOption.gd index f14cef0..f14cef0 100644 --- a/game/src/ArgumentOption.gd +++ b/game/src/Autoload/Arguments/ArgumentOption.gd diff --git a/game/src/ArgumentParser.gd b/game/src/Autoload/Arguments/ArgumentParser.gd index f1ee371..ce89dd8 100644 --- a/game/src/ArgumentParser.gd +++ b/game/src/Autoload/Arguments/ArgumentParser.gd @@ -53,11 +53,18 @@ func _parse_value(arg_name : StringName, value_string : String, type : Variant.T return true if value_string == "false" or value_string == "f" or value_string == "no" or value_string == "n": return false - return true + push_error("'%s' must be a valid boolean, '%s' is an invalid value." % [arg_name, value_string]) + return null TYPE_INT: - return value_string.to_int() + if value_string.is_valid_int(): + return value_string.to_int() + push_error("'%s' must be a valid integer, '%s' is an invalid value." % [arg_name, value_string]) + return null TYPE_FLOAT: - return value_string.to_float() + if value_string.is_valid_float(): + return value_string.to_float() + push_error("'%s' must be a valid float, '%s' is an invalid value." % [arg_name, value_string]) + return null TYPE_STRING, TYPE_STRING_NAME: return value_string TYPE_COLOR: @@ -204,10 +211,11 @@ func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray) continue current_key = key - var arg_result = _parse_value(key, value, current_option.type) - if arg_result != null: - dictionary[current_option.name] = arg_result - current_option = null + if first_equal > -1: + var arg_result = _parse_value(key, value, current_option.type) + if arg_result != null: + dictionary[current_option.name] = arg_result + current_option = null return dictionary diff --git a/game/src/Autoload/Arguments/ArgumentParser.tscn b/game/src/Autoload/Arguments/ArgumentParser.tscn new file mode 100644 index 0000000..8fda8f1 --- /dev/null +++ b/game/src/Autoload/Arguments/ArgumentParser.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=6 format=3 uid="uid://dayjmgc34tqo6"] + +[ext_resource type="Script" path="res://src/Autoload/Arguments/ArgumentParser.gd" id="1_pc7xr"] +[ext_resource type="Script" path="res://src/Autoload/Arguments/ArgumentOption.gd" id="2_4hguj"] + +[sub_resource type="Resource" id="Resource_tq3y4"] +script = ExtResource("2_4hguj") +name = &"help" +aliases = Array[StringName]([&"h"]) +type = 1 +description = "Displays help and quits." +default_value = false + +[sub_resource type="Resource" id="Resource_j1to4"] +script = ExtResource("2_4hguj") +name = &"game-debug" +aliases = Array[StringName]([&"d", &"-debug", &"-debug-mode"]) +type = 1 +description = "Start in debug mode." +default_value = false + +[sub_resource type="Resource" id="Resource_tiax1"] +script = ExtResource("2_4hguj") +name = &"compatibility-mode" +aliases = Array[StringName]([&"-compat"]) +type = 4 +description = "Load Victoria 2 assets from this path." +default_value = "" + +[node name="ArgumentParser" type="Node"] +script = ExtResource("1_pc7xr") +option_array = Array[ExtResource("2_4hguj")]([SubResource("Resource_tq3y4"), SubResource("Resource_j1to4"), SubResource("Resource_tiax1")]) diff --git a/game/src/Autoload/Events.gd b/game/src/Autoload/Events.gd index 8800041..4387cc7 100644 --- a/game/src/Autoload/Events.gd +++ b/game/src/Autoload/Events.gd @@ -17,20 +17,25 @@ var _define_filepaths_dict : Dictionary = { GameSingleton.get_good_icons_dir_key(): "res://art/economy/goods" } -# Set this to your Vic2 install dir or a mod's dir to enable compatibility mode -# (this won't work for mods which rely on vanilla map assets, copy missing assets -# into the mod's dir for a temporary fix) -const _compatibility_mode_path : String = "" - # REQUIREMENTS # * FS-333, FS-334, FS-335, FS-341 func _ready(): GameSingleton.setup_logger() + # Set this to your Vic2 install dir or a mod's dir to enable compatibility mode + # (this won't work for mods which rely on vanilla map assets, copy missing assets + # into the mod's dir for a temporary fix) + # Usage: OpenVic --compatibility-mode <path> + + var compatibility_mode_path : String + if ProjectSettings.has_setting(ArgumentParser.argument_setting_path): + var arg_dictionary : Dictionary = ProjectSettings.get_setting(ArgumentParser.argument_setting_path) + compatibility_mode_path = arg_dictionary.get(&"compatibility-mode", compatibility_mode_path) + var start := Time.get_ticks_usec() - if _compatibility_mode_path: - if GameSingleton.load_defines_compatibility_mode(_compatibility_mode_path) != OK: + if compatibility_mode_path: + if GameSingleton.load_defines_compatibility_mode(compatibility_mode_path) != OK: push_error("Errors loading game defines!") else: if GameSingleton.load_defines(_define_filepaths_dict) != OK: diff --git a/game/src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd b/game/src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd index 0d8d8b7..67060bf 100644 --- a/game/src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd +++ b/game/src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd @@ -113,6 +113,7 @@ func update_info() -> void: show() else: hide() + mouse_exited.emit() func _on_province_selected(index : int) -> void: _selected_index = index diff --git a/game/src/GameStart.tscn b/game/src/GameStart.tscn index d5f9d45..2046bb5 100644 --- a/game/src/GameStart.tscn +++ b/game/src/GameStart.tscn @@ -1,6 +1,5 @@ -[gd_scene load_steps=7 format=3 uid="uid://1udsn4mggep2"] +[gd_scene load_steps=6 format=3 uid="uid://1udsn4mggep2"] -[ext_resource type="PackedScene" uid="uid://dayjmgc34tqo6" path="res://src/ArgumentParser.tscn" id="1_oe61r"] [ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="1_wlojq"] [ext_resource type="Script" path="res://src/SplashContainer.gd" id="2_xmcgv"] [ext_resource type="Texture2D" uid="uid://deef5hufq0j61" path="res://splash_assets/splash_end.png" id="3_qfv12"] @@ -15,8 +14,6 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="ArgumentParser" parent="." instance=ExtResource("1_oe61r")] - [node name="GameMenu" parent="." instance=ExtResource("1_wlojq")] visible = false layout_mode = 1 diff --git a/game/src/MusicConductor/SongInfo.gd b/game/src/MusicConductor/SongInfo.gd index f7343c0..1ee9adc 100644 --- a/game/src/MusicConductor/SongInfo.gd +++ b/game/src/MusicConductor/SongInfo.gd @@ -1,4 +1,4 @@ -extends Node +extends Resource class_name SongInfo var song_path : String = "" |