Allow converting track by individual track pieces instead of whole tiles

Ctrl-click on convert button

See: #509
This commit is contained in:
Jonathan G Rennison
2023-05-06 16:20:23 +01:00
parent 09e03fb6b2
commit 31f476220d
8 changed files with 379 additions and 5 deletions

View File

@@ -632,6 +632,7 @@ static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
TrackBits vehicle_track = Train::From(v)->track;
if (!(vehicle_track & TRACK_BIT_WORMHOLE)) {
if (info->mode == TBIFM_ACROSS_ONLY && !(GetAcrossBridgePossibleTrackBits(info->t) & vehicle_track)) return nullptr;
if (info->mode == TBIFM_PRIMARY_ONLY && !(GetPrimaryTunnelBridgeTrackBits(info->t) & vehicle_track)) return nullptr;
}
}
@@ -643,7 +644,7 @@ static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
* @param tile first end
* @param endtile second end
* @param ignore Ignore this vehicle when searching
* @param mode Whether to only find vehicles which are passing across the bridge/tunnel or on connecting bridge head track pieces
* @param mode Whether to only find vehicles which are passing across the bridge/tunnel or on connecting bridge head track pieces, or only on primary track type pieces
* @return Succeeded command (if tunnel/bridge is free) or failed command (if a vehicle is using the tunnel/bridge).
*/
CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore, TunnelBridgeIsFreeMode mode)