diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -25,7 +25,7 @@ var game = null var view = null const { - all_hexes, hex_exists, hex_road, side_road, side_limit, hex_name, regions, + all_hexes, hex_exists, hex_all_road, hex_road, side_road, side_limit, hex_name, regions, unit_name, unit_appearance, unit_elite, unit_class, unit_speed, unit_max_steps, } = require("./data.js") @@ -1363,12 +1363,33 @@ function trace_unit_supply_line(path, here, here_move, ssrc) { 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) + // Sometimes we can stop searching if we reach a supplied highway. + if (hex_road[next] === HIGHWAY && supply_net[next] === 2) { + + // But only if we can't continue by trail or track. + // If we always stop we'll miss possible departures that reconnect + // to the highway elsewhere. + // + // Example: Tobruk - EL Adem - Sidi Rezegh - Ft. Capuzzo + + // Not enough movement left to leave highway: if (next_move === BACK_HIGHWAY_3 || next_move === BACK_STOP) reached = true + + // MAYBE WRONG + // (can we leave supplied highway to connect to chain elsewhere?) + // Only these places can reconnect to the highway using trail/track: + if ( + next !== 35 && // Gazala + next !== 55 && // Er Regima + next !== 61 && // Bir Harmat + next !== 62 && // El Adem + next !== 64 && // Ft. Capuzzo + next !== 65 && // Sollum + next !== 78 // Ghemines + ) + reached = true + } } // reached supply source |