summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-12-04 12:56:15 +0100
committerTor Andersson <tor@ccxvii.net>2024-12-04 12:57:44 +0100
commit67d0bc93091c45dde6237cf19fc98d248e8f5638 (patch)
tree04a525de56edb38bd12b1d9409cd6fb50cf8a4e1 /rules.js
parent752fc022630dfdba7ce06cfdd30cf894e2e50f96 (diff)
downloadrommel-in-the-desert-67d0bc93091c45dde6237cf19fc98d248e8f5638.tar.gz
Fix eslint issues - remove dead code.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js42
1 files changed, 14 insertions, 28 deletions
diff --git a/rules.js b/rules.js
index 40704eb..9035336 100644
--- a/rules.js
+++ b/rules.js
@@ -25,7 +25,7 @@ var game = null
var view = null
const {
- all_hexes, hex_exists, hex_all_road, hex_road, side_road, side_limit, hex_name, regions,
+ all_hexes, hex_exists, 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")
@@ -131,8 +131,6 @@ const TRAIL = 1
const TRACK = 2
const HIGHWAY = 4
-const SUPPLY_RANGE = [ 1, 2, 3, 0, 3 ]
-
const FIREPOWER_MATRIX = [
[ SF, DF, SF, TF ],
[ SF, SF, DF, TF ],
@@ -1453,14 +1451,6 @@ function trace_supply_network_3() {
}
}
-function all_hexes_sorted_by_distance_to_base(x) {
- return all_hexes.slice().sort((a,b) => {
- let da = distance_to[x][a]
- let db = distance_to[x][b]
- return db - da
- })
-}
-
function trace_supply_network(start) {
check_timeout()
@@ -3149,7 +3139,7 @@ states.final_supply_check_rout = {
function save_withdrawal_supply_lines() {
game.withdraw = {}
- let net = game.withdraw.supply_net = friendly_supply_network().slice()
+ game.withdraw.supply_net = friendly_supply_network().slice()
game.withdraw.supply_line = friendly_supply_line().slice()
// Units assigned fortress supply MUST withdraw using fortress supply lines,
@@ -3834,7 +3824,7 @@ function goto_overrun(where) {
goto_rout(where, true, null)
}
-function do_gen_move_to(from, to, speed) {
+function do_gen_move_to(_from, to, speed) {
if (can_move_to(to, speed)) {
gen_action_hex(to)
} else if (can_move_to(to, speed + 1)) {
@@ -4954,10 +4944,6 @@ function end_rout() {
// ==== COMBAT PHASE ===
-function has_mandatory_combats() {
- return is_mandatory_combat(BARDIA) || is_mandatory_combat(BENGHAZI) || is_mandatory_combat(TOBRUK)
-}
-
function has_mandatory_withdrawals() {
return (
(is_mandatory_combat(BARDIA) && is_valid_withdrawal_group_move_from(BARDIA)) ||
@@ -5213,12 +5199,12 @@ function roll_battle_fire(who, tc) {
result.push(" ")
for (let i = 0; i < cv; ++i) {
let roll = roll_die()
- if (roll >= fp) {
- result.push(die_face_hit[roll])
- ++total
- } else {
- result.push(die_face_miss[roll])
- }
+ if (roll >= fp) {
+ result.push(die_face_hit[roll])
+ ++total
+ } else {
+ result.push(die_face_miss[roll])
+ }
}
}
@@ -6163,7 +6149,7 @@ states.buildup_reinforcements = {
gen_action_hex(friendly_base())
},
- hex(base) {
+ hex(_base) {
apply_reinforcements()
goto_buildup_spending()
},
@@ -6298,7 +6284,7 @@ function replacement_cost(who) {
function can_redeploy_from(from) {
if (is_battle_hex(from)) {
let n = 0
- for_each_undisrupted_friendly_unit_in_hex(from, u => {
+ for_each_undisrupted_friendly_unit_in_hex(from, _u => {
n++
})
return n > 1
@@ -6895,7 +6881,7 @@ function end_game() {
})
let allied = 0
- for_each_allied_unit_on_map(u => {
+ for_each_allied_unit_on_map(_u => {
allied += 1.0
})
@@ -7525,7 +7511,7 @@ exports.scenarios = [
"1941-42"
]
-exports.setup = function (seed, scenario, options) {
+exports.setup = function (seed, scenario, _options) {
load_state({
seed: seed,
log: [],
@@ -7688,7 +7674,7 @@ exports.view = function(state, current) {
return common_view(current)
}
-exports.query = function (state, current, q) {
+exports.query = function (state, _player, q) {
timeout = Date.now() + TIMEOUT // don't think too long!
if (q === 'supply') {
load_state(state)