aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorСмердокрыл <smerdokryl@gmail.com>2025-10-26 20:08:52 +0200
committerGitHub <noreply@github.com>2025-10-26 19:08:52 +0100
commite8252152cfff5fad65fa0ba8f857d85dc9c7dbf6 (patch)
tree7a29608132cf94b2b20e5b12af75e4d5f7e796a8
parentd5ac1c87417e943b99ec95fd2041664484c380f2 (diff)
Tools/map_extractor: Fix segfault with CONF_allow_float_to_int=false (#31353)
-rw-r--r--src/tools/map_extractor/System.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index b0fbed1960d..e50eb89bf86 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -891,7 +891,7 @@ bool ConvertADT(ChunkedFile& adt, std::string const& mapName, std::string const&
}
else
{
- int minX = 255, minY = 255;
+ int minX = ADT_GRID_SIZE, minY = ADT_GRID_SIZE;
int maxX = 0, maxY = 0;
maxHeight = -20000;
minHeight = 20000;
@@ -927,6 +927,9 @@ bool ConvertADT(ChunkedFile& adt, std::string const& mapName, std::string const&
liquidHeader.height = maxY - minY + 1 + 1;
liquidHeader.liquidLevel = minHeight;
+ if (minY > maxY || minX > maxX)
+ liquidHeader.flags |= map_liquidHeaderFlags::NoHeight;
+
if (maxHeight == minHeight)
liquidHeader.flags |= map_liquidHeaderFlags::NoHeight;