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 (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);
|
DiagDirection dir = GetTunnelBridgeDirection(tile);
|
||||||
Track track = DiagDirToDiagTrack(dir);
|
Track track = DiagDirToDiagTrack(dir);
|
||||||
CommandCost ret = CheckTrainReservationPreventsTrackModification(tile, track);
|
if (HasTunnelReservation(tile)) {
|
||||||
if (ret.Failed()) return ret;
|
CommandCost ret = CheckTrainReservationPreventsTrackModification(tile, track);
|
||||||
ret = CheckTrainReservationPreventsTrackModification(endtile, track);
|
if (ret.Failed()) return ret;
|
||||||
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
|
/* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until
|
||||||
|
Reference in New Issue
Block a user