Fix #7571 Track design ghost generates money

The problem was that when placing a ride ghost, some clearance checks are performed to see if nothing stands in the way, and if it does, it tries to raise the ride to a height where it's possible to place. When this happens, it removes all ghost track pieces that have already been placed, and tries at the next height. With clearance checks disabled, this check was still performed, while it should ignore clearance altogether.
This commit is contained in:
Hielke Morsink 2018-05-29 14:06:09 +02:00 committed by Aaron van Geffen
parent bf44007197
commit 9396da9b71
3 changed files with 12 additions and 4 deletions

View File

@ -33,6 +33,7 @@
- Fix: [#7480] Graphs skip values of 0.
- Fix: [#7528] In park entrance pricing tab, switching tabs happens on mouse-down instead of mouse-up
- Fix: [#7544] Starting a headless server with no arguments causes the game to freeze.
- Fix: [#7571] Hovering a ride design over scenery will give tons of money.
- Improved: [#2989] Multiplayer window now changes title when tab changes.
- Improved: [#5339] Change eyedropper icon to actual eyedropper and change cursor to crosshair.
- Improved: [#5832] Resize tile inspector automatically when selecting a tile element.

View File

@ -3328,7 +3328,7 @@ void map_obstruction_set_error_text(rct_tile_element *tileElement)
* ebp = clearFunc
* bl = bl
*/
sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, CLEAR_FUNC clearFunc, uint8 bl, uint8 flags, money32 *price, uint8 crossingMode)
bool map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, CLEAR_FUNC clearFunc, uint8 bl, uint8 flags, money32 *price, uint8 crossingMode)
{
sint32 al, ah, bh, cl, ch, water_height;
al = ah = bh = cl = ch = water_height = 0;
@ -3336,10 +3336,17 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z
gMapGroundFlags = ELEMENT_IS_ABOVE_GROUND;
bool canBuildCrossing = false;
if (x >= gMapSizeUnits || y >= gMapSizeUnits || x < 32 || y < 32) {
if (x >= gMapSizeUnits || y >= gMapSizeUnits || x < 32 || y < 32)
{
gGameCommandErrorText = STR_OFF_EDGE_OF_MAP;
return false;
}
if (gCheatsDisableClearanceChecks)
{
return true;
}
rct_tile_element* tileElement = map_get_first_element_at(x / 32, y / 32);
do {
if (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE) {
@ -3351,7 +3358,7 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z
continue;
}
water_height = surface_get_water_height(tileElement) * 2;
if (water_height && water_height > zLow && tileElement->base_height < zHigh && !gCheatsDisableClearanceChecks) {
if (water_height && water_height > zLow && tileElement->base_height < zHigh) {
gMapGroundFlags |= ELEMENT_IS_UNDERWATER;
if (water_height < zHigh) {
goto loc_68BAE6;

View File

@ -173,7 +173,7 @@ using CLEAR_FUNC = sint32(*)(rct_tile_element** tile_element, sint32 x, sint32 y
sint32 map_place_non_scenery_clear_func(rct_tile_element** tile_element, sint32 x, sint32 y, uint8 flags, money32* price);
sint32 map_place_scenery_clear_func(rct_tile_element** tile_element, sint32 x, sint32 y, uint8 flags, money32* price);
sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, CLEAR_FUNC clearFunc, uint8 bl, uint8 flags, money32 *price, uint8 crossingMode);
bool map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, CLEAR_FUNC clearFunc, uint8 bl, uint8 flags, money32 *price, uint8 crossingMode);
sint32 map_can_construct_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, uint8 bl);
void rotate_map_coordinates(sint16 *x, sint16 *y, sint32 rotation);
LocationXY16 coordinate_3d_to_2d(const LocationXYZ16* coordinate_3d, sint32 rotation);