mirror of https://github.com/OpenRCT2/OpenRCT2.git
Prefer setNull/isNull on TopToolbar over LOCATION_NULL
This commit is contained in:
parent
48c2dc31bc
commit
109a90269c
|
@ -1217,7 +1217,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (w == nullptr)
|
if (w == nullptr)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,7 +1349,7 @@ static void sub_6E1F34(
|
||||||
auto gridCoords = screen_get_map_xy_quadrant({ x, y }, &cl);
|
auto gridCoords = screen_get_map_xy_quadrant({ x, y }, &cl);
|
||||||
if (!gridCoords)
|
if (!gridCoords)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gridPos = *gridCoords;
|
gridPos = *gridCoords;
|
||||||
|
@ -1363,7 +1363,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (surfaceElement == nullptr)
|
if (surfaceElement == nullptr)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,7 +1382,7 @@ static void sub_6E1F34(
|
||||||
auto mapCoords = screen_get_map_xy_quadrant_with_z({ x, y }, z, &cl);
|
auto mapCoords = screen_get_map_xy_quadrant_with_z({ x, y }, z, &cl);
|
||||||
if (!mapCoords)
|
if (!mapCoords)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gridPos = *mapCoords;
|
gridPos = *mapCoords;
|
||||||
|
@ -1398,7 +1398,7 @@ static void sub_6E1F34(
|
||||||
gSceneryPlaceZ = z;
|
gSceneryPlaceZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gridPos.x == LOCATION_NULL)
|
if (gridPos.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t rotation = gWindowSceneryRotation;
|
uint8_t rotation = gWindowSceneryRotation;
|
||||||
|
@ -1437,7 +1437,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1451,7 +1451,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (surfaceElement == nullptr)
|
if (surfaceElement == nullptr)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1473,7 +1473,7 @@ static void sub_6E1F34(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
}
|
}
|
||||||
// If SHIFT pressed
|
// If SHIFT pressed
|
||||||
if (gSceneryShiftPressed)
|
if (gSceneryShiftPressed)
|
||||||
|
@ -1486,7 +1486,7 @@ static void sub_6E1F34(
|
||||||
gSceneryPlaceZ = z;
|
gSceneryPlaceZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gridPos.x == LOCATION_NULL)
|
if (gridPos.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gridPos = gridPos.ToTileStart();
|
gridPos = gridPos.ToTileStart();
|
||||||
|
@ -1519,7 +1519,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1545,7 +1545,7 @@ static void sub_6E1F34(
|
||||||
auto gridCoords = screen_get_map_xy_side({ x, y }, &cl);
|
auto gridCoords = screen_get_map_xy_side({ x, y }, &cl);
|
||||||
if (!gridCoords)
|
if (!gridCoords)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gridPos = *gridCoords;
|
gridPos = *gridCoords;
|
||||||
|
@ -1559,7 +1559,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (surfaceElement == nullptr)
|
if (surfaceElement == nullptr)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1577,7 +1577,7 @@ static void sub_6E1F34(
|
||||||
auto mapCoords = screen_get_map_xy_side_with_z({ x, y }, z, &cl);
|
auto mapCoords = screen_get_map_xy_side_with_z({ x, y }, z, &cl);
|
||||||
if (!mapCoords)
|
if (!mapCoords)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gridPos = *mapCoords;
|
gridPos = *mapCoords;
|
||||||
|
@ -1593,7 +1593,7 @@ static void sub_6E1F34(
|
||||||
gSceneryPlaceZ = z;
|
gSceneryPlaceZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gridPos.x == LOCATION_NULL)
|
if (gridPos.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_secondaryColour = gWindowScenerySecondaryColour;
|
_secondaryColour = gWindowScenerySecondaryColour;
|
||||||
|
@ -1613,7 +1613,7 @@ static void sub_6E1F34(
|
||||||
const CoordsXY mapCoords = sub_68A15E({ x, y });
|
const CoordsXY mapCoords = sub_68A15E({ x, y });
|
||||||
gridPos = mapCoords;
|
gridPos = mapCoords;
|
||||||
|
|
||||||
if (gridPos.x == LOCATION_NULL)
|
if (gridPos.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gSceneryPlaceZ = 0;
|
gSceneryPlaceZ = 0;
|
||||||
|
@ -1625,7 +1625,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (surfaceElement == nullptr)
|
if (surfaceElement == nullptr)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1647,7 +1647,7 @@ static void sub_6E1F34(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If SHIFT pressed
|
// If SHIFT pressed
|
||||||
|
@ -1661,11 +1661,10 @@ static void sub_6E1F34(
|
||||||
gSceneryPlaceZ = z;
|
gSceneryPlaceZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gridPos.x == LOCATION_NULL)
|
if (gridPos.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gridPos.x &= 0xFFE0;
|
gridPos = gridPos.ToTileStart();
|
||||||
gridPos.y &= 0xFFE0;
|
|
||||||
|
|
||||||
uint8_t rotation = gWindowSceneryRotation;
|
uint8_t rotation = gWindowSceneryRotation;
|
||||||
rotation -= get_current_rotation();
|
rotation -= get_current_rotation();
|
||||||
|
@ -1689,7 +1688,7 @@ static void sub_6E1F34(
|
||||||
|
|
||||||
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
||||||
{
|
{
|
||||||
gridPos.x = LOCATION_NULL;
|
gridPos.setNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1752,7 +1751,7 @@ static void window_top_toolbar_scenery_tool_down(int16_t x, int16_t y, rct_windo
|
||||||
|
|
||||||
sub_6E1F34(x, y, selectedTab, gridPos, ¶meter_1, ¶meter_2, ¶meter_3);
|
sub_6E1F34(x, y, selectedTab, gridPos, ¶meter_1, ¶meter_2, ¶meter_3);
|
||||||
|
|
||||||
if (gridPos.x == LOCATION_NULL)
|
if (gridPos.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (sceneryType)
|
switch (sceneryType)
|
||||||
|
@ -2681,7 +2680,7 @@ static void top_toolbar_tool_update_scenery(int16_t x, int16_t y)
|
||||||
|
|
||||||
sub_6E1F34(x, y, selected_tab, mapTile, ¶meter1, ¶meter2, ¶meter3);
|
sub_6E1F34(x, y, selected_tab, mapTile, ¶meter1, ¶meter2, ¶meter3);
|
||||||
|
|
||||||
if (mapTile.x == LOCATION_NULL)
|
if (mapTile.isNull())
|
||||||
{
|
{
|
||||||
scenery_remove_ghost_tool_placement();
|
scenery_remove_ghost_tool_placement();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -160,6 +160,11 @@ struct CoordsXY
|
||||||
{
|
{
|
||||||
return x == COORDS_NULL;
|
return x == COORDS_NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setNull()
|
||||||
|
{
|
||||||
|
x = COORDS_NULL;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TileCoordsXY
|
struct TileCoordsXY
|
||||||
|
|
Loading…
Reference in New Issue