MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / MapGetTrackElementAtBeforeSurfaceFromRide

Function MapGetTrackElementAtBeforeSurfaceFromRide

src/openrct2/world/Map.cpp:2031–2052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2029 }
2030
2031 TileElement* MapGetTrackElementAtBeforeSurfaceFromRide(const CoordsXYZ& trackPos, const RideId rideIndex)
2032 {
2033 TileElement* tileElement = MapGetFirstElementAt(trackPos);
2034 if (tileElement == nullptr)
2035 return nullptr;
2036
2037 do
2038 {
2039 if (tileElement->getType() == TileElementType::Surface)
2040 {
2041 return nullptr;
2042 }
2043
2044 if (tileElement->getType() == TileElementType::Track && tileElement->getBaseZ() == trackPos.z
2045 && tileElement->asTrack()->GetRideIndex() == rideIndex)
2046 {
2047 return tileElement;
2048 }
2049 } while (!(tileElement++)->isLastForTile());
2050
2051 return nullptr;
2052 }
2053
2054 /**
2055 * Gets the track element at x, y, z that is the given track type and sequence.

Callers 1

UpdateLandscapeDoorsMethod · 0.85

Calls 6

MapGetFirstElementAtFunction · 0.85
getTypeMethod · 0.45
getBaseZMethod · 0.45
GetRideIndexMethod · 0.45
asTrackMethod · 0.45
isLastForTileMethod · 0.45

Tested by

no test coverage detected