1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Reformat code on updating crossings

This commit is contained in:
Rik Smeets
2022-09-23 07:11:15 +02:00
parent 53877c244c
commit 189ebbced7

View File

@@ -9250,29 +9250,25 @@ void Vehicle::UpdateCrossings() const
xyElement = { backVehicle->TrackLocation,
map_get_track_element_at_of_type_seq(backVehicle->TrackLocation, backVehicle->GetTrackType(), 0) };
curZ = backVehicle->TrackLocation.z;
if (xyElement.element != nullptr)
if (xyElement.element == nullptr)
{
uint8_t freeCount = travellingForwards ? 3 : 1;
return;
}
while (freeCount-- > 0)
uint8_t freeCount = travellingForwards ? 3 : 1;
while (freeCount-- > 0)
{
if (travellingForwards && track_block_get_previous(xyElement, &output))
{
if (travellingForwards)
{
if (track_block_get_previous(xyElement, &output))
{
xyElement.x = output.begin_x;
xyElement.y = output.begin_y;
xyElement.element = output.begin_element;
}
}
xyElement.x = output.begin_x;
xyElement.y = output.begin_y;
xyElement.element = output.begin_element;
}
auto* pathElement = map_get_path_element_at(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() }));
if (pathElement != nullptr)
{
pathElement->SetIsBlockedByVehicle(false);
}
auto* pathElement = map_get_path_element_at(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() }));
if (pathElement != nullptr)
{
pathElement->SetIsBlockedByVehicle(false);
}
}
}