From 132ab424f7e57f6fb8162b93f0e8bd20f686ceee Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Tue, 14 Jan 2020 21:51:38 -0300 Subject: [PATCH] Use loop on footpath_update_path_wide() to iterate with CoordsDirectionDelta --- src/openrct2/world/Footpath.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index aa0c21d6fb..0dc9719e86 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -1717,22 +1717,16 @@ void footpath_update_path_wide_flags(const CoordsXY& footpathPos) TileElement* pathList[8]; auto pathPos = footpathPos + CoordsDirectionDelta[7]; - pathList[0] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[1]; - pathList[1] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[1]; - pathList[2] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[2]; - pathList[3] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[2]; - pathList[4] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[3]; - pathList[5] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[3]; - pathList[6] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[0]; - pathList[7] = footpath_can_be_wide(pathPos, height); - pathPos += CoordsDirectionDelta[1]; + Direction direction = 1; + int32_t i = 0; + while (i < 8) + { + pathList[i++] = footpath_can_be_wide(pathPos, height); + pathPos += CoordsDirectionDelta[direction]; + pathList[i++] = footpath_can_be_wide(pathPos, height); + pathPos += CoordsDirectionDelta[direction]; + direction = direction_next(direction); + } uint8_t pathConnections = 0; if (tileElement->AsPath()->GetEdges() & EDGE_NW)