aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-06-13 00:34:06 +0200
committer hop311 <hop3114@gmail.com>2024-06-13 21:26:35 +0200
commitdb246d901d1ccd39b0ed3fc024f28ad7b6b4848b (patch)
tree0c06560ddae94550077c997f8b7e14f69057f236 /extension/src/openvic-extension/classes
parent72ae774f249fb408d5a3e3de09695c251906a7cc (diff)
Updated SIM to use separate Instance and Definition Managersinstance-definition-managers
Diffstat (limited to 'extension/src/openvic-extension/classes')
-rw-r--r--extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp b/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp
index 51a4235..fdc1a10 100644
--- a/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp
+++ b/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp
@@ -36,11 +36,20 @@ Error GFXMaskedFlagTexture::_generate_combined_image() {
if (mask_image.is_valid() && flag_image.is_valid() && flag_image_rect.has_area()) {
const Vector2i centre_translation = (mask_image->get_size() - button_image->get_size()) / 2;
- for (Vector2i combined_image_point { 0, 0 }; combined_image_point.y < button_image->get_height(); ++combined_image_point.y) {
+
+ for (
+ Vector2i combined_image_point { 0, 0 };
+ combined_image_point.y < button_image->get_height();
+ ++combined_image_point.y
+ ) {
+
for (combined_image_point.x = 0; combined_image_point.x < button_image->get_width(); ++combined_image_point.x) {
+
const Color overlay_image_colour = overlay_image->get_pixelv(combined_image_point);
+
// Translate to mask_image coordinates, keeping the centres of each image aligned.
const Vector2i mask_image_point = combined_image_point + centre_translation;
+
if (
0 <= mask_image_point.x && mask_image_point.x < mask_image->get_width() &&
0 <= mask_image_point.y && mask_image_point.y < mask_image->get_height()
@@ -176,13 +185,15 @@ Error GFXMaskedFlagTexture::set_flag_country_and_type(Country const* new_flag_co
return _generate_combined_image();
}
-Error GFXMaskedFlagTexture::set_flag_country_name_and_type(String const& new_flag_country_name, StringName const& new_flag_type) {
+Error GFXMaskedFlagTexture::set_flag_country_name_and_type(
+ String const& new_flag_country_name, StringName const& new_flag_type
+) {
if (new_flag_country_name.is_empty()) {
return set_flag_country_and_type(nullptr, {});
}
GameSingleton* game_singleton = GameSingleton::get_singleton();
ERR_FAIL_NULL_V(game_singleton, FAILED);
- Country const* new_flag_country = game_singleton->get_game_manager().get_country_manager().get_country_by_identifier(
+ Country const* new_flag_country = game_singleton->get_definition_manager().get_country_manager().get_country_by_identifier(
godot_to_std_string(new_flag_country_name)
);
ERR_FAIL_NULL_V_MSG(new_flag_country, FAILED, vformat("Country not found: %s", new_flag_country_name));
@@ -200,7 +211,7 @@ Error GFXMaskedFlagTexture::set_flag_country_name(String const& new_flag_country
}
GameSingleton* game_singleton = GameSingleton::get_singleton();
ERR_FAIL_NULL_V(game_singleton, FAILED);
- Country const* new_flag_country = game_singleton->get_game_manager().get_country_manager().get_country_by_identifier(
+ Country const* new_flag_country = game_singleton->get_definition_manager().get_country_manager().get_country_by_identifier(
godot_to_std_string(new_flag_country_name)
);
ERR_FAIL_NULL_V_MSG(new_flag_country, FAILED, vformat("Country not found: %s", new_flag_country_name));