1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Improved raising land near edge map

Rather than showing the user an 'off edge map!' error, this simply makes the affected area smaller.
This commit is contained in:
Hielke Morsink
2018-03-18 12:49:04 +01:00
committed by Michael Steenbeek
parent 7bc63dc30a
commit 2d1d60294c
2 changed files with 13 additions and 0 deletions

View File

@@ -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)
------------------------------------------------------------------------

View File

@@ -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<decltype(ax)>(32, ax);
bx = std::min<decltype(bx)>(gMapSizeMaxXY, bx);
ay = std::max<decltype(bx)>(32, ay);
by = std::min<decltype(by)>(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<decltype(ax)>(32, ax);
bx = std::min<decltype(bx)>(gMapSizeMaxXY, bx);
ay = std::max<decltype(bx)>(32, ay);
by = std::min<decltype(by)>(gMapSizeMaxXY, by);
uint8 max_height = map_get_highest_land_height(ax, bx, ay, by);
for (sint32 yi = ay; yi <= by; yi += 32) {