From 50ae79910ddaf2adf87be4dd8ec6c63dd25447a5 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 22 Jan 2023 15:22:27 +0000 Subject: [PATCH] Fix TGP map max height for maps larger than 4k in both axes --- src/tgp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tgp.cpp b/src/tgp.cpp index c73759b43e..d4f2ab4280 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -237,7 +237,7 @@ static height_t TGPGetMaxHeight() { 12, 19, 25, 31, 67, 75, 87 }, ///< Alpinist }; - int map_size_bucket = std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS; + int map_size_bucket = std::min(std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS, max_height_array_size - 1); int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][map_size_bucket]; /* If there is a manual map height limit, clamp to it. */