mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactored the goto statement
This commit is contained in:
parent
0a5b75e882
commit
6e077c42ea
|
@ -900,9 +900,9 @@ bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction dir
|
||||||
if (stationElement != nullptr)
|
if (stationElement != nullptr)
|
||||||
{
|
{
|
||||||
int32_t targetTrackType;
|
int32_t targetTrackType;
|
||||||
if (x == stationX1 && y == stationY1)
|
if ((x == stationX1 && y == stationY1)
|
||||||
|
|| (x + CoordsDirectionDelta[direction].x == removeX && y + CoordsDirectionDelta[direction].y == removeY))
|
||||||
{
|
{
|
||||||
loc_6C4BF5:;
|
|
||||||
auto stationIndex = ride_get_first_empty_station_start(ride);
|
auto stationIndex = ride_get_first_empty_station_start(ride);
|
||||||
if (stationIndex == STATION_INDEX_NULL)
|
if (stationIndex == STATION_INDEX_NULL)
|
||||||
{
|
{
|
||||||
|
@ -923,14 +923,7 @@ bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction dir
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x + CoordsDirectionDelta[direction].x == removeX && y + CoordsDirectionDelta[direction].y == removeY)
|
if (x - CoordsDirectionDelta[direction].x == removeX && y - CoordsDirectionDelta[direction].y == removeY)
|
||||||
{
|
|
||||||
goto loc_6C4BF5;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (x - CoordsDirectionDelta[direction].x == removeX
|
|
||||||
&& y - CoordsDirectionDelta[direction].y == removeY)
|
|
||||||
{
|
{
|
||||||
targetTrackType = TRACK_ELEM_BEGIN_STATION;
|
targetTrackType = TRACK_ELEM_BEGIN_STATION;
|
||||||
}
|
}
|
||||||
|
@ -946,7 +939,6 @@ bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
stationElement->AsTrack()->SetTrackType(targetTrackType);
|
stationElement->AsTrack()->SetTrackType(targetTrackType);
|
||||||
|
|
||||||
map_invalidate_element({ x, y }, stationElement);
|
map_invalidate_element({ x, y }, stationElement);
|
||||||
|
|
Loading…
Reference in New Issue