summaryrefslogtreecommitdiff
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
parent752fc022630dfdba7ce06cfdd30cf894e2e50f96 (diff)
downloadrommel-in-the-desert-67d0bc93091c45dde6237cf19fc98d248e8f5638.tar.gz
Fix eslint issues - remove dead code.
-rw-r--r--data.js3
-rw-r--r--rules.js42
-rw-r--r--tools/gendata.js5
3 files changed, 16 insertions, 34 deletions
diff --git a/data.js b/data.js
index 24e7630..580fb65 100644
--- a/data.js
+++ b/data.js
@@ -2,7 +2,6 @@
const all_hexes = [7,8,9,10,30,31,32,33,34,35,36,37,38,39,40,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,147,148,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,203,204,205,213]
const hex_exists = [0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0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,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,0,0,2,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,1,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,2,0,0,2,2,0,2,0,0,2,0,0,2,0,2,2,0,0,2,0,0,2,0,0,2,0,0,2,0,0,2,0,0,2,2,0,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
const hex_name = {"4":"Malta","7":"El Garib","8":"Cyrene","9":"El Gubba","10":"Derna","30":"Tocra","31":"Barce","32":"Marawa","33":"Wadi Cuff","34":"Derna SW","35":"Gazala","36":"Acroma","37":"Tobruk","38":"Belhamed","39":"Gambut","40":"Bardia","47":"Exited","48":"Return for Refit","49":"Alexandria Queue","53":"Exited","54":"Benghazi","55":"Er Regima","56":"Charruba","57":"Mechili W","58":"Mechili","59":"Rotonda Segnali","60":"Sidi Mufta","61":"Bir Harmat","62":"El Adem","63":"Sidi Rezegh","64":"Ft. Capuzzo","65":"Sollum","66":"Buq Buq","67":"Sidi Barrani","68":"Mersa Matruh W","69":"Mersa Matruh","70":"Fuka","71":"El Daba","72":"El Alamein","73":"El Hamam","74":"Alexandria","78":"Ghemines","79":"Skeleidima","80":"Msus","81":"Msus E","82":"Mechili SW","83":"Tengeder","84":"Tengeder E","85":"Bir Hacheim","86":"Retma","87":"Bir Gubi","88":"Gabr Saleh","89":"Sidi Omar","90":"Bir Habata","91":"Sofafi","92":"Bir el Kenayis W","93":"Bir el Kenayis","94":"Bir Khalda","95":"Fuka SE","96":"El Alamein SW","97":"Alam Halfa","98":"Alexandria SW","99":"Map Edge","102":"Return for Refit","103":"Beda Fomm","104":"Antelat","105":"Msus SE","106":"Ben Gania","107":"Tengeder SW","108":"Tengeder SE","109":"Bir Hacheim SW","110":"Bir Hacheim SE","111":"Bir Gubi SW","112":"Ft. Maddalena W","113":"Ft. Maddalena","114":"Ft. Maddalena E","115":"Bir Khamsa","116":"Bir el Qatrani","117":"Bir el Kenayis SW","118":"Bir el Kenayis SE","119":"Western Desert","120":"El Himeimat W","121":"El Himeimat","122":"El Himeimat E","123":"Alexandria SW SE","127":"El Agheila Queue","128":"Agedabia","129":"Jebel el Matar","130":"Haraga","131":"Haraga E","132":"Libya","133":"Jalo Oasis Trail","134":"Libya","135":"Libya","136":"Libya","137":"Ft. Maddalena SW","138":"Ft. Maddalena SE","139":"Bir Khamsa SW","140":"Bir Khamsa SE","141":"Bir Fuad","142":"Bir Fuad E","143":"Western Desert","144":"Western Desert","145":"Qattara Depression","146":"Qattara Depression","147":"Qattara Depression","148":"Map Edge","151":"El Agheila","152":"Mersa Brega","153":"El Haseiat","154":"Haraga SW","155":"Haraga SE","156":"Libya","157":"Jalo Oasis Trail","158":"Libya","159":"Libya","160":"Libya","161":"Libya","162":"Jarabub Oasis NW","163":"Jarabub Oasis NE","164":"Siwa Oasis NE NW","165":"Bir Fuad SW","166":"Bir Fuad SE","167":"Western Desert","175":"Map Edge","176":"Maaten Giofer","177":"Maaten Giofer E","178":"Sahaba","179":"Jalo Oasis NW","180":"Jalo Oasis NE","181":"Jalo Oasis Trail","182":"Libya Trail","183":"Libya Trail","184":"Libya Trail","185":"Libya Trail","186":"Jarabub Oasis W","187":"Jarabub Oasis","188":"Jarabub Oasis E","189":"Siwa Oasis NE","190":"Western Desert","191":"Western Desert","197":"Map Edge","203":"Jalo Oasis W","204":"Jalo Oasis","205":"Jalo Oasis E","213":"Siwa Oasis"}
@@ -15,6 +14,6 @@ const unit_class = [0,0,1,1,1,1,1,1,1,1,1,1,1,3,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,
const unit_speed = [3,3,3,2,2,1,1,1,1,1,1,1,1,1,4,4,4,3,3,3,3,3,3,3,2,2,1,1,1,3,3,2,2,1,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,3,1,1,1,1,1,3,3,3,2,2,2,2,2,2,4,2,2,2,2,2,2,2,2,3,3,3,2,2]
if (typeof module !== 'undefined')
module.exports = {
- all_hexes, hex_exists, hex_name, hex_all_road, hex_road, side_road, side_limit, regions,
+ all_hexes, hex_exists, hex_name, hex_road, side_road, side_limit, regions,
unit_name, unit_appearance, unit_max_steps, unit_elite, unit_class, unit_speed,
}
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)
diff --git a/tools/gendata.js b/tools/gendata.js
index fb64009..065a837 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -31,7 +31,6 @@ let hex_exists = new Array(map_w*map_h).fill(1);
let side_limit = new Array(map_w*map_h*3).fill(CLEAR);
let side_road = new Array(map_w*map_h*3).fill(0);
let hex_road = new Array(map_w*map_h).fill(0);
-let hex_all_road = new Array(map_w*map_h).fill(0);
function add_side(s, t) {
if (side_limit[s])
@@ -59,7 +58,6 @@ function def_side(t,a,b) {
function def_road(t, list) {
for (let i = 0; i < list.length; ++i) {
- hex_all_road[list[i]] |= t;
if (t > hex_road[list[i]])
hex_road[list[i]] = t;
}
@@ -655,7 +653,6 @@ let data = "// DON'T EDIT - AUTOGENERATED\n"
data += "const all_hexes = " + JSON.stringify(all_hexes) + "\n"
data += "const hex_exists = " + JSON.stringify(hex_exists) + "\n"
data += "const hex_road = " + JSON.stringify(hex_road) + "\n"
-data += "const hex_all_road = " + JSON.stringify(hex_all_road) + "\n"
data += "const side_road = " + JSON.stringify(side_road) + "\n"
data += "const side_limit = " + JSON.stringify(side_limit) + "\n"
data += "const hex_name = " + JSON.stringify(hex_name) + "\n"
@@ -669,7 +666,7 @@ gen_array("unit_class", u => u.class)
gen_array("unit_speed", u => u.speed)
data += "if (typeof module !== 'undefined')\n\tmodule.exports = {\n"
-data += "\t\tall_hexes, hex_exists, hex_name, hex_all_road, hex_road, side_road, side_limit, regions,\n"
+data += "\t\tall_hexes, hex_exists, hex_name, hex_road, side_road, side_limit, regions,\n"
data += "\t\tunit_name, unit_appearance, unit_max_steps, unit_elite, unit_class, unit_speed,\n"
data += "\t}\n"