summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-13 18:34:49 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commit19c0a7a39a01b3803a391b46cdf64548eae6b8ca (patch)
treecb0659ed5fb95f0b7ef53444ed7405a51e76c55f
parent40aab1ddc7ced4e6010c14105ab26a85b7a4895c (diff)
downloadrommel-in-the-desert-19c0a7a39a01b3803a391b46cdf64548eae6b8ca.tar.gz
Don't release hex control immediately after forced march regroups.
-rw-r--r--rules.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/rules.js b/rules.js
index 29444d2..b5aa38e 100644
--- a/rules.js
+++ b/rules.js
@@ -739,6 +739,7 @@ function release_hex_control(a) {
set_delete(game.allied_sides, side)
}
})
+ hide_units_in_hex(a)
}
function claim_hex_control_for_defender(a) {
@@ -4221,10 +4222,14 @@ states.retreat_move = {
}
function end_retreat() {
- if (!is_battle_hex(game.retreat)) {
- release_hex_control(game.retreat)
- hide_units_in_hex(game.retreat)
+ if ((game.to1 || game.to2) && game.forced.length > 0) {
+ // Don't release in case a forced march regroup teleports units back into battle.
+ // Wait until goto_combat_phase to release these hexes.
+ } else {
+ if (!is_battle_hex(game.retreat))
+ release_hex_control(game.retreat)
}
+
game.retreat_units = null
// mark shielding units as moved
@@ -4489,7 +4494,6 @@ function end_rout() {
log_br()
game.state = game.rout.state
release_hex_control(game.rout.from)
- hide_units_in_hex(game.rout.from)
set_delete(game.new_battles, game.rout.from)
@@ -4513,9 +4517,19 @@ function is_mandatory_combat(fortress) {
return false
}
+function release_retreat_hex_control() {
+ for (let x of all_hexes)
+ if (!is_battle_hex(x))
+ if (set_has(game.axis_hexes, x) || set_has(game.allied_hexes, x))
+ release_hex_control(x)
+}
+
function goto_combat_phase() {
set_active_player()
+ // Release hexes that were retreated from here
+ release_retreat_hex_control()
+
reveal_visited_minefields()
if (game.turn_option === 'pass') {
@@ -4764,10 +4778,8 @@ function goto_battle(x) {
}
function end_battle() {
- if (!is_battle_hex(game.battle)) {
+ if (!is_battle_hex(game.battle))
release_hex_control(game.battle)
- hide_units_in_hex(game.battle)
- }
set_delete(game.new_battles, game.battle)
set_delete(game.active_battles, game.battle)