diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 246575d69c..b081489442 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -1579,7 +1579,7 @@ static void map_window_set_pixels(rct_window* w) for (int32_t i = 0; i < MAXIMUM_MAP_SIZE_TECHNICAL; i++) { - if (x > 0 && y > 0 && x < gMapSizeUnits && y < gMapSizeUnits) + if (!map_is_edge({ x, y })) { switch (w->selected_tab) { diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index 51fe9f8760..ccc6a13ed5 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -183,7 +183,7 @@ GameActions::Result::Ptr LargeSceneryPlaceAction::Query() const res->GroundFlags = tempSceneryGroundFlags; - if (!LocationValid(curTile) || curTile.x >= gMapSizeUnits || curTile.y >= gMapSizeUnits) + if (!LocationValid(curTile) || map_is_edge(curTile)) { return std::make_unique(GameActions::Status::Disallowed, STR_OFF_EDGE_OF_MAP); } diff --git a/src/openrct2/actions/PlaceParkEntranceAction.cpp b/src/openrct2/actions/PlaceParkEntranceAction.cpp index 248353afee..c3153c32a6 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.cpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.cpp @@ -50,8 +50,7 @@ GameActions::Result::Ptr PlaceParkEntranceAction::Query() const res->Expenditure = ExpenditureType::LandPurchase; res->Position = { _loc.x, _loc.y, _loc.z }; - if (!LocationValid(_loc) || _loc.x <= 32 || _loc.y <= 32 || _loc.x >= (gMapSizeUnits - 32) - || _loc.y >= (gMapSizeUnits - 32)) + if (!LocationValid(_loc) || map_is_edge(_loc)) { return std::make_unique( GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP); diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index f015922d4a..cd7626c086 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -47,7 +47,7 @@ const int32_t SEGMENTS_ALL = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | */ void tile_element_paint_setup(paint_session* session, const CoordsXY& mapCoords, bool isTrackPiecePreview) { - if (mapCoords.x < gMapSizeUnits && mapCoords.y < gMapSizeUnits && mapCoords.x >= 32 && mapCoords.y >= 32) + if (!map_is_edge(mapCoords)) { paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0); paint_util_force_set_general_support_height(session, -1, 0); diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 1f4e5ad951..618ec14d36 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -1322,7 +1322,7 @@ std::unique_ptr MapCanConstructWithClearAt( res->GroundFlags = ELEMENT_IS_ABOVE_GROUND; bool canBuildCrossing = false; - if (pos.x >= gMapSizeUnits || pos.y >= gMapSizeUnits || pos.x < 32 || pos.y < 32) + if (map_is_edge(pos)) { res->Error = GameActions::Status::InvalidParameters; res->ErrorMessage = STR_OFF_EDGE_OF_MAP;