From 2d1d60294c1ded1c510bffbd555cad9feae26198 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Sun, 18 Mar 2018 12:49:04 +0100 Subject: [PATCH] Improved raising land near edge map Rather than showing the user an 'off edge map!' error, this simply makes the affected area smaller. --- distribution/changelog.txt | 1 + src/openrct2/world/Map.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 3af9a592ce..4f0a63a3be 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.1.3 (in development) ------------------------------------------------------------------------ - Feature: [#7267] Leverage more historical data in Finances window. +- Improved: Raising land near the map edge makes the affected area smaller instead of showing an 'off edge map' error. 0.1.2 (2018-03-18) ------------------------------------------------------------------------ diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 379dfadbc6..55b435e701 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -1846,6 +1846,12 @@ static money32 raise_land(sint32 flags, sint32 x, sint32 y, sint32 z, sint32 ax, audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z); } + // Keep big coordinates within map boundaries + ax = std::max(32, ax); + bx = std::min(gMapSizeMaxXY, bx); + ay = std::max(32, ay); + by = std::min(gMapSizeMaxXY, by); + uint8 min_height = map_get_lowest_land_height(ax, bx, ay, by); for (sint32 yi = ay; yi <= by; yi += 32) { @@ -1893,6 +1899,12 @@ static money32 lower_land(sint32 flags, sint32 x, sint32 y, sint32 z, sint32 ax, return MONEY32_UNDEFINED; } + // Keep big coordinates within map boundaries + ax = std::max(32, ax); + bx = std::min(gMapSizeMaxXY, bx); + ay = std::max(32, ay); + by = std::min(gMapSizeMaxXY, by); + uint8 max_height = map_get_highest_land_height(ax, bx, ay, by); for (sint32 yi = ay; yi <= by; yi += 32) {