diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 18bfbb9be4..1e3e0eafa4 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -3615,13 +3615,12 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords) if (_autoRotatingShop && _rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE && ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP)) { - TileElement* pathsByDir[4]; + TileElement* pathsByDir[NumOrthogonalDirections]; bool keepOrientation = false; - for (int8_t i = 0; i < 4; i++) + for (int8_t i = 0; i < NumOrthogonalDirections; i++) { - pathsByDir[i] = map_get_footpath_element({ mapCoords->x + (DirectionOffsets[i].x * COORDS_XY_STEP), - mapCoords->y + (DirectionOffsets[i].y * COORDS_XY_STEP), z }); + pathsByDir[i] = map_get_footpath_element({ *mapCoords + CoordsDirectionDelta[i], z }); if (pathsByDir[i] && (pathsByDir[i])->AsPath()->IsSloped() && (pathsByDir[i])->AsPath()->GetSlopeDirection() != i) { @@ -3631,9 +3630,7 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords) // Sloped path on the level below if (!pathsByDir[i]) { - pathsByDir[i] = map_get_footpath_element({ mapCoords->x + (DirectionOffsets[i].x * COORDS_XY_STEP), - mapCoords->y + (DirectionOffsets[i].y * COORDS_XY_STEP), - z - PATH_HEIGHT_STEP }); + pathsByDir[i] = map_get_footpath_element({ *mapCoords + CoordsDirectionDelta[i], z - PATH_HEIGHT_STEP }); if (pathsByDir[i] && (!(pathsByDir[i])->AsPath()->IsSloped()