aboutsummaryrefslogtreecommitdiff
path: root/extension/src/MapSingleton.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-04-13 20:37:31 +0200
committer Hop311 <hop3114@gmail.com>2023-04-13 20:37:31 +0200
commit66e63d41a109d85b10396e8a2dd934a829cc57fe (patch)
treedfa1b40b6f4f555b9f25e5ddc3abfa46f7728a4b /extension/src/MapSingleton.cpp
parent7523c42190c9211ea65db3b00b9476487c61052a (diff)
Small fixes
Diffstat (limited to 'extension/src/MapSingleton.cpp')
-rw-r--r--extension/src/MapSingleton.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/extension/src/MapSingleton.cpp b/extension/src/MapSingleton.cpp
index 7ad404c..73cf522 100644
--- a/extension/src/MapSingleton.cpp
+++ b/extension/src/MapSingleton.cpp
@@ -243,8 +243,8 @@ Province* MapSingleton::get_province_from_uv_coords(godot::Vector2 const& coords
if (province_index_image.is_valid()) {
const PackedByteArray index_data_array = province_index_image->get_data();
Province::index_t const* index_data = reinterpret_cast<Province::index_t const*>(index_data_array.ptr());
- const int32_t x_mod_w = UtilityFunctions::posmod(coords.x, 1.0f) * get_width();
- const int32_t y_mod_h = UtilityFunctions::posmod(coords.y, 1.0f) * get_height();
+ const int32_t x_mod_w = UtilityFunctions::fposmod(coords.x, 1.0f) * get_width();
+ const int32_t y_mod_h = UtilityFunctions::fposmod(coords.y, 1.0f) * get_height();
return map.get_province_by_index(index_data[x_mod_w + y_mod_h * get_width()]);
}
return nullptr;
@@ -254,8 +254,8 @@ Province const* MapSingleton::get_province_from_uv_coords(godot::Vector2 const&
if (province_index_image.is_valid()) {
const PackedByteArray index_data_array = province_index_image->get_data();
Province::index_t const* index_data = reinterpret_cast<Province::index_t const*>(index_data_array.ptr());
- const int32_t x_mod_w = UtilityFunctions::posmod(coords.x, 1.0f) * get_width();
- const int32_t y_mod_h = UtilityFunctions::posmod(coords.y, 1.0f) * get_height();
+ const int32_t x_mod_w = UtilityFunctions::fposmod(coords.x, 1.0f) * get_width();
+ const int32_t y_mod_h = UtilityFunctions::fposmod(coords.y, 1.0f) * get_height();
return map.get_province_by_index(index_data[x_mod_w + y_mod_h * get_width()]);
}
return nullptr;