diff options
-rw-r--r-- | rules.js | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -230,7 +230,8 @@ const all_power_trains = [ const TRAIN_IA = 32 const all_pieces = [ ...all_power_generals.flat(), ...all_power_trains.flat() ] -const all_generals = [ ...all_power_generals.flat() ] +const all_generals = all_power_generals.flat() +const all_trains = all_power_trains.flat() const all_prussia_trains = [ ...all_power_trains[P_PRUSSIA], @@ -751,6 +752,13 @@ function has_any_piece(to) { return false } +function has_any_supply_train(to) { + for (let p of all_trains) + if (game.pos[p] === to) + return true + return false +} + function has_friendly_supply_train(to) { for (let p of all_friendly_trains[game.power]) if (game.pos[p] === to) @@ -1910,7 +1918,7 @@ function has_available_depot() { } function can_re_enter_general(to) { - if (has_friendly_supply_train(to)) + if (has_any_supply_train(to)) return false if (has_any_other_general(to)) return false |