1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 13:03:11 +01:00

Convert track_element_is_block_start() to member function

This commit is contained in:
Gymnasiast
2020-08-10 21:15:48 +02:00
parent be0123decb
commit 9d24655056
4 changed files with 6 additions and 6 deletions

View File

@@ -1085,9 +1085,9 @@ void TrackElement::SetHasChain(bool on)
* A beginning of a block can be the end of a station, the end of a lift hill,
* or a block brake.
*/
bool track_element_is_block_start(TileElement* trackElement)
bool TrackElement::IsBlockStart() const
{
switch (trackElement->AsTrack()->GetTrackType())
switch (GetTrackType())
{
case TRACK_ELEM_END_STATION:
case TRACK_ELEM_CABLE_LIFT_HILL:
@@ -1097,7 +1097,7 @@ bool track_element_is_block_start(TileElement* trackElement)
case TRACK_ELEM_60_DEG_UP_TO_FLAT:
case TRACK_ELEM_DIAG_25_DEG_UP_TO_FLAT:
case TRACK_ELEM_DIAG_60_DEG_UP_TO_FLAT:
if (trackElement->AsTrack()->HasChain())
if (HasChain())
{
return true;
}

View File

@@ -571,7 +571,6 @@ bool track_circuit_iterators_match(const track_circuit_iterator* firstIt, const
void track_get_back(CoordsXYE* input, CoordsXYE* output);
void track_get_front(CoordsXYE* input, CoordsXYE* output);
bool track_element_is_block_start(TileElement* trackElement);
bool track_element_is_covered(int32_t trackElementType);
bool track_type_is_station(track_type_t trackType);

View File

@@ -6750,7 +6750,7 @@ static void block_brakes_open_previous_section(Ride& ride, const CoordsXYZ& vehi
return;
}
}
} while (!track_element_is_block_start(trackBeginEnd.begin_element));
} while (!(trackBeginEnd.begin_element->AsTrack()->IsBlockStart()));
// Get the start of the track block instead of the end
location = { trackBeginEnd.begin_x, trackBeginEnd.begin_y, trackBeginEnd.begin_z };
@@ -7917,7 +7917,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_11;
}
if (track_element_is_block_start(tileElement))
if (tileElement->AsTrack()->IsBlockStart())
{
if (next_vehicle_on_train == SPRITE_INDEX_NULL)
{

View File

@@ -376,6 +376,7 @@ public:
void SetDoorBState(uint8_t newState);
bool IsStation() const;
bool IsBlockStart() const;
};
assert_struct_size(TrackElement, 16);