Fix crash when clearing tunnel where only near end is reserved with realistic braking
This commit is contained in:
@@ -1206,13 +1206,17 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
|
||||
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL && _settings_game.vehicle.train_braking_model == TBM_REALISTIC && HasTunnelReservation(tile)) {
|
||||
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL && _settings_game.vehicle.train_braking_model == TBM_REALISTIC) {
|
||||
DiagDirection dir = GetTunnelBridgeDirection(tile);
|
||||
Track track = DiagDirToDiagTrack(dir);
|
||||
CommandCost ret = CheckTrainReservationPreventsTrackModification(tile, track);
|
||||
if (ret.Failed()) return ret;
|
||||
ret = CheckTrainReservationPreventsTrackModification(endtile, track);
|
||||
if (ret.Failed()) return ret;
|
||||
if (HasTunnelReservation(tile)) {
|
||||
CommandCost ret = CheckTrainReservationPreventsTrackModification(tile, track);
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
if (HasTunnelReservation(endtile)) {
|
||||
ret = CheckTrainReservationPreventsTrackModification(endtile, track);
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until
|
||||
|
Reference in New Issue
Block a user