From 96cf0f95bfc02cfad0f7b8f0c75d4e1ca038d297 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 22 Jun 2022 18:00:07 +0100 Subject: [PATCH] Adjust tunnel/bridge signal spacing to prefer a signal in the middle --- src/tunnelbridge_cmd.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 71489dcdc3..c60cc11020 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -143,6 +143,11 @@ uint GetBestTunnelBridgeSignalSimulationSpacing(TileIndex begin, TileIndex end, int lower = target - (target / 4); int upper = std::min(16, target + (target / 3)); + if ((target * 2) >= length) { + /* See whether signal would be better in the middle */ + lower = (length + 1) / 2; + } + int best_gap = -1; int best_spacing = 0; for (int i = lower; i <= upper; i++) {