mirror of https://github.com/OpenTTD/OpenTTD
parent
7ccdefa1c1
commit
8d501f2db1
|
@ -3550,6 +3550,20 @@ static Vehicle *CollectTrackbitsFromCrashedVehiclesEnum(Vehicle *v, void *data)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsRailStationPlatformOccupied(TileIndex tile)
|
||||||
|
{
|
||||||
|
TileIndexDiff delta = (GetRailStationAxis(tile) == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
|
||||||
|
|
||||||
|
for (TileIndex t = tile; IsCompatibleTrainStationTile(t, tile); t -= delta) {
|
||||||
|
if (HasVehicleOnPos(t, nullptr, &TrainOnTileEnum)) return true;
|
||||||
|
}
|
||||||
|
for (TileIndex t = tile + delta; IsCompatibleTrainStationTile(t, tile); t += delta) {
|
||||||
|
if (HasVehicleOnPos(t, nullptr, &TrainOnTileEnum)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes/Clears the last wagon of a crashed train. It takes the engine of the
|
* Deletes/Clears the last wagon of a crashed train. It takes the engine of the
|
||||||
* train, then goes to the last wagon and deletes that. Each call to this function
|
* train, then goes to the last wagon and deletes that. Each call to this function
|
||||||
|
@ -3608,6 +3622,13 @@ static void DeleteLastWagon(Train *v)
|
||||||
/* check if the wagon was on a road/rail-crossing */
|
/* check if the wagon was on a road/rail-crossing */
|
||||||
if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile);
|
if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile);
|
||||||
|
|
||||||
|
if (IsRailStationTile(tile)) {
|
||||||
|
bool occupied = IsRailStationPlatformOccupied(tile);
|
||||||
|
DiagDirection dir = AxisToDiagDir(GetRailStationAxis(tile));
|
||||||
|
SetRailStationPlatformReservation(tile, dir, occupied);
|
||||||
|
SetRailStationPlatformReservation(tile, ReverseDiagDir(dir), occupied);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update signals */
|
/* Update signals */
|
||||||
if (IsTileType(tile, MP_TUNNELBRIDGE) || IsRailDepotTile(tile)) {
|
if (IsTileType(tile, MP_TUNNELBRIDGE) || IsRailDepotTile(tile)) {
|
||||||
UpdateSignalsOnSegment(tile, INVALID_DIAGDIR, owner);
|
UpdateSignalsOnSegment(tile, INVALID_DIAGDIR, owner);
|
||||||
|
|
Loading…
Reference in New Issue