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

Method ReserveTrackUnderConsist

src/train_cmd.cpp:3120–3134  ·  view source on GitHub ↗

Tries to reserve track under whole train consist. */

Source from the content-addressed store, hash-verified

3118
3119/** Tries to reserve track under whole train consist. */
3120void Train::ReserveTrackUnderConsist() const
3121{
3122 for (const Train *u = this; u != nullptr; u = u->Next()) {
3123 switch (u->track) {
3124 case TRACK_BIT_WORMHOLE:
3125 TryReserveRailTrack(u->tile, DiagDirToDiagTrack(GetTunnelBridgeDirection(u->tile)));
3126 break;
3127 case TRACK_BIT_DEPOT:
3128 break;
3129 default:
3130 TryReserveRailTrack(u->tile, TrackBitsToTrack(u->track));
3131 break;
3132 }
3133 }
3134}
3135
3136/**
3137 * The train vehicle crashed!

Callers 2

TrainCrashedFunction · 0.80
AfterLoadGameFunction · 0.80

Calls 5

TryReserveRailTrackFunction · 0.85
DiagDirToDiagTrackFunction · 0.85
GetTunnelBridgeDirectionFunction · 0.85
TrackBitsToTrackFunction · 0.85
NextMethod · 0.45

Tested by

no test coverage detected