diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-10-09 01:25:41 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-10-09 01:25:41 +0200 |
commit | 2a80615797e5126a117fcda434f0f430074da7dc (patch) | |
tree | 8161f174c8a710d2ca85f6a15ceaba5684a87d29 | |
parent | b7b59ba6f61496b103fa693a3186051872f02ddb (diff) | |
download | wilderness-war-2a80615797e5126a117fcda434f0f430074da7dc.tar.gz |
Change some forEach to for of.
-rw-r--r-- | rules.js | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -3026,15 +3026,15 @@ function gen_naval_move() { if (!piece_can_naval_move_from(moving_piece(), from)) return if (game.active === BRITAIN) { - game.amphib.forEach(to => { + for (let to of game.amphib) { if (to !== from) gen_action_move(from, to) - }) - ports.forEach(to => { + } + for (let to of ports) { if (to !== from && !set_has(game.amphib, to)) if (is_friendly_controlled_space(to)) gen_action_move(from, to) - }) + } } if (game.active === FRANCE) { if (from !== LOUISBOURG && is_friendly_controlled_space(LOUISBOURG)) @@ -6460,20 +6460,20 @@ states.go_home_to = { } if (has_unbesieged_friendly_leader(from)) { - find_closest_friendly_unbesieged_fortification(from).forEach(to => { + for (let to of find_closest_friendly_unbesieged_fortification(from)) { can_go_home = true gen_action_space(to) - }) + } } else if (game.go_home.follow && game.go_home.follow[from]) { can_go_home = true game.go_home.follow[from].forEach(gen_action_space) } } else { // Leader alone in the wilderness; or leaders, rangers, and coureurs after raid. - find_closest_friendly_unbesieged_fortification(from).forEach(to => { + for (let to of find_closest_friendly_unbesieged_fortification(from)) { can_go_home = true gen_action_space(to) - }) + } } if (!can_go_home) |