From f204785c5cabda643d757396b51c1409625556f5 Mon Sep 17 00:00:00 2001 From: Duncan Date: Sat, 20 Jun 2020 20:17:52 +0100 Subject: [PATCH] Fix Action Location for SurfaceSetStyle (#12012) LocationValid function was not being called in LandSmoothAction. This did not cause issues as the nested call to land set height would check for valid locations. --- src/openrct2/actions/LandSmoothAction.hpp | 8 ++++---- src/openrct2/actions/SurfaceSetStyleAction.hpp | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/openrct2/actions/LandSmoothAction.hpp b/src/openrct2/actions/LandSmoothAction.hpp index ef68723978..f6d73848cc 100644 --- a/src/openrct2/actions/LandSmoothAction.hpp +++ b/src/openrct2/actions/LandSmoothAction.hpp @@ -113,7 +113,7 @@ private: money32 totalCost = 0; // check if we need to start at all - if (!map_is_location_valid(loc) || !map_is_location_valid({ loc.x + stepX, loc.y + stepY })) + if (!LocationValid(loc) || !LocationValid({ loc.x + stepX, loc.y + stepY })) { return 0; } @@ -149,7 +149,7 @@ private: nextLoc.y += stepY; // check if we need to continue after raising the current tile // this needs to be checked before the tile is changed - if (!map_is_location_valid({ nextLoc.x + stepX, nextLoc.y + stepY })) + if (!LocationValid({ nextLoc.x + stepX, nextLoc.y + stepY })) { shouldContinue &= ~0x3; } @@ -265,7 +265,7 @@ private: } // check if we need to start at all - if (!map_is_location_valid(loc) || !map_is_location_valid({ loc.x + stepX, loc.y + stepY })) + if (!LocationValid(loc) || !LocationValid({ loc.x + stepX, loc.y + stepY })) { return 0; } @@ -292,7 +292,7 @@ private: nextLoc.y += stepY; // check if we need to continue after raising the current tile // this needs to be checked before the tile is changed - if (!map_is_location_valid({ nextLoc.x + stepX, nextLoc.y + stepY })) + if (!LocationValid({ nextLoc.x + stepX, nextLoc.y + stepY })) { shouldContinue = false; } diff --git a/src/openrct2/actions/SurfaceSetStyleAction.hpp b/src/openrct2/actions/SurfaceSetStyleAction.hpp index 670a935c13..423a8462d0 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.hpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.hpp @@ -194,6 +194,9 @@ public: { for (coords.y = validRange.GetTop(); coords.y <= validRange.GetBottom(); coords.y += COORDS_XY_STEP) { + if (!LocationValid(coords)) + continue; + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { if (!map_is_location_in_park(coords))