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

Function TrainApproachingCrossingEnum

src/train_cmd.cpp:1715–1723  ·  view source on GitHub ↗

* Checks if a train is approaching a rail-road crossing * @param v vehicle on tile * @param tile tile with crossing we are testing * @return true if v is approaching a crossing */

Source from the content-addressed store, hash-verified

1713 * @return true if v is approaching a crossing
1714 */
1715static bool TrainApproachingCrossingEnum(const Vehicle *v, TileIndex tile)
1716{
1717 if (v->type != VEH_TRAIN || v->vehstatus.Test(VehState::Crashed)) return false;
1718
1719 const Train *t = Train::From(v);
1720 if (!t->IsFrontEngine()) return false;
1721
1722 return TrainApproachingCrossingTile(t) == tile;
1723}
1724
1725
1726/**

Callers 1

TrainApproachingCrossingFunction · 0.85

Calls 3

TestMethod · 0.80
IsFrontEngineMethod · 0.80

Tested by

no test coverage detected