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

Function RoadVehCheckTrainCrash

src/roadveh_cmd.cpp:573–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573static bool RoadVehCheckTrainCrash(RoadVehicle *v)
574{
575 for (RoadVehicle *u = v; u != nullptr; u = u->Next()) {
576 if (u->state == RVSB_WORMHOLE) continue;
577
578 TileIndex tile = u->tile;
579
580 if (!IsLevelCrossingTile(tile)) continue;
581
582 if (HasVehicleNearTileXY(v->x_pos, v->y_pos, 4, [&u](const Vehicle *t) {
583 return t->type == VEH_TRAIN && abs(t->z_pos - u->z_pos) <= 6;
584 })) {
585 RoadVehCrash(v);
586 return true;
587 }
588 }
589
590 return false;
591}
592
593TileIndex RoadVehicle::GetOrderStationLocation(StationID station)
594{

Callers 1

RoadVehControllerFunction · 0.85

Calls 5

IsLevelCrossingTileFunction · 0.85
HasVehicleNearTileXYFunction · 0.85
absFunction · 0.85
RoadVehCrashFunction · 0.85
NextMethod · 0.45

Tested by

no test coverage detected