Close #14903. Use map_is_edge

This commit is contained in:
duncanspumpkin 2021-06-15 07:49:57 +01:00 committed by Gymnasiast
parent 517935e580
commit ae6657dcdc
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
5 changed files with 5 additions and 6 deletions

View File

@ -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)
{

View File

@ -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<LargeSceneryPlaceActionResult>(GameActions::Status::Disallowed, STR_OFF_EDGE_OF_MAP);
}

View File

@ -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::Result>(
GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_TOO_CLOSE_TO_EDGE_OF_MAP);

View File

@ -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);

View File

@ -1322,7 +1322,7 @@ std::unique_ptr<GameActions::ConstructClearResult> 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;