Fix crash when removing unreserved tunnel when realistic braking enabled

This commit is contained in:
Jonathan G Rennison
2021-02-04 21:09:21 +00:00
parent 48395cb2db
commit db04bc090e

View File

@@ -1200,7 +1200,7 @@ 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) {
if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL && _settings_game.vehicle.train_braking_model == TBM_REALISTIC && HasTunnelReservation(tile)) {
DiagDirection dir = GetTunnelBridgeDirection(tile);
Track track = DiagDirToDiagTrack(dir);
CommandCost ret = CheckTrainReservationPreventsTrackModification(tile, track);