MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetReservedTrackbits

Function GetReservedTrackbits

src/pbs.cpp:24–48  ·  view source on GitHub ↗

* Get the reserved trackbits for any tile, regardless of type. * @param t the tile * @return the reserved trackbits. TRACK_BIT_NONE on nothing reserved or * a tile without rail. */

Source from the content-addressed store, hash-verified

22 * a tile without rail.
23 */
24TrackBits GetReservedTrackbits(TileIndex t)
25{
26 switch (GetTileType(t)) {
27 case MP_RAILWAY:
28 if (IsRailDepot(t)) return GetDepotReservationTrackBits(t);
29 if (IsPlainRail(t)) return GetRailReservationTrackBits(t);
30 break;
31
32 case MP_ROAD:
33 if (IsLevelCrossing(t)) return GetCrossingReservationTrackBits(t);
34 break;
35
36 case MP_STATION:
37 if (HasStationRail(t)) return GetStationReservationTrackBits(t);
38 break;
39
40 case MP_TUNNELBRIDGE:
41 if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) return GetTunnelBridgeReservationTrackBits(t);
42 break;
43
44 default:
45 break;
46 }
47 return TRACK_BIT_NONE;
48}
49
50/**
51 * Set the reservation for a complete station platform.

Callers 10

CmdRemoveSingleSignalFunction · 0.85
CmdConvertRailFunction · 0.85
FollowReservationFunction · 0.85
IsWaitingPositionFreeFunction · 0.85
ChooseTrainTrackFunction · 0.85
TrainControllerFunction · 0.85
HasReservedTracksFunction · 0.85
MaskReservedTracksMethod · 0.85
ReservationCostMethod · 0.85

Calls 11

GetTileTypeFunction · 0.85
IsRailDepotFunction · 0.85
IsPlainRailFunction · 0.85
IsLevelCrossingFunction · 0.85
HasStationRailFunction · 0.85

Tested by

no test coverage detected