diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1361,9 +1361,18 @@ function trace_unit_supply_line(path, here, here_move, ssrc) { if (next_move === TRACE_ABORT) continue - // reached supply source, or reached supplied highway (that we searched before) - /* if (next === ssrc) -- fallback without short cut in case the optimization below is wrong... */ - if (next === ssrc || (hex_road[next] === HIGHWAY && supply_net[next] === 2)) { + let reached = (next === ssrc) + if (!reached) { + // Stop searching if we reach a supplied highway, + // but only if we can't continue by trail or track. + // Example: Tobruk - EL Adem - Sidi Rezegh - Ft. Capuzzo + if (hex_road[next] === HIGHWAY && supply_net[next] === 2) + if (next_move === BACK_HIGHWAY_3 || next_move === BACK_STOP) + reached = true + } + + // reached supply source + if (reached) { for (let x of path) supply_line[x] = 2 supply_line[side] = 2 |