From ad11f065d685726d782cd835a2019a5347269e0f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 29 Jul 2022 14:28:58 +0200 Subject: Load map and insert svg dynamically. --- map.svg | 364 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ play.html | 370 +------------------------------------------------------------- play.js | 23 +++- rules.js | 12 +- 4 files changed, 399 insertions(+), 370 deletions(-) create mode 100644 map.svg diff --git a/map.svg b/map.svg new file mode 100644 index 0000000..76f8730 --- /dev/null +++ b/map.svg @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Rommel in the Desert +Copyright © 2022 Columbia Games Inc. + + + +2 +5 +2 + + + + + +LIBYA +EGYPT +Cyrenaica +Western Desert + + + +Jebel el Akhdar + + + +Qattara Depression + + + +Gulf +of +Sirte +Gulf of Bomba +Gulf of Sollum +Mediterranean Sea + + + +Benghazi +Alexandria +Ghemines +Derna +El Agheila +Bardia +Tobruk +Sollum + + + + + + + + + +SABKHA +EL SEGIRA +SABKHA +EL JENEINEN +SABKHA +AL AKHARIYAH + +Gazala + +Jalo Oasis +Jarabub Oasis +Siwa Oasis + +Bir Habata +Bir Khamsa +Bir Sheferzen +Ft. Maddalena +Ft. Capuzzo +Bir Hacheim +Tmimi +Acroma +El Himeimat + +El Alamein +Gabr Saleh +Ben Gania +Bir el Qatrani +Skeleidima +Sahaba +Jebel el +Matar +Mersa +Matruh +Marawa + + +Solluch +Pass +Halfaya +Pass + +Martuba +Maaten Giofer +El Abiar +Saunnu +Retma +Belhamed +Bir Fuad +Bir el Kenayis +Bir Khalda +El Hamam +Haraga +Rotonda +Segnali +Sidi +Mufta +Bir Harmat +El Adem +Bir Gubi +Sidi Rezegh +Gambut +Omar +Sidi +Mersa Brega +Buq Buq +Sofafi +Beda +Fomm +Fuka +El Daba +Alam Halfa +El Haseiat +Er Regima +Tocra +Antelat +Msus +Charruba +El Garib +Wadi +Cuff +El Gubba +Mechili +Tengeder +Sidi Barrani +Agedabia +Barce +Cyrene + + + + + + + + + diff --git a/play.html b/play.html index 4ef8647..b1162c6 100644 --- a/play.html +++ b/play.html @@ -625,370 +625,12 @@ svg .hex.tip {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Rommel in the Desert -Copyright © 2022 Columbia Games Inc. - - - -2 -5 -2 - - - - - -LIBYA -EGYPT -Cyrenaica -Western Desert - - - -Jebel el Akhdar - - - -Qattara Depression - - - -Gulf -of -Sirte -Gulf of Bomba -Gulf of Sollum -Mediterranean Sea - - - -Benghazi -Alexandria -Ghemines -Derna -El Agheila -Bardia -Tobruk -Sollum - - - - - - - - - -SABKHA -EL SEGIRA -SABKHA -EL JENEINEN -SABKHA -AL AKHARIYAH - -Gazala - -Jalo Oasis -Jarabub Oasis -Siwa Oasis - -Bir Habata -Bir Khamsa -Bir Sheferzen -Ft. Maddalena -Ft. Capuzzo -Bir Hacheim -Tmimi -Acroma -El Himeimat - -El Alamein -Gabr Saleh -Ben Gania -Bir el Qatrani -Skeleidima -Sahaba -Jebel el -Matar -Mersa -Matruh -Marawa - - -Solluch -Pass -Halfaya -Pass - -Martuba -Maaten Giofer -El Abiar -Saunnu -Retma -Belhamed -Bir Fuad -Bir el Kenayis -Bir Khalda -El Hamam -Haraga -Rotonda -Segnali -Sidi -Mufta -Bir Harmat -El Adem -Bir Gubi -Sidi Rezegh -Gambut -Omar -Sidi -Mersa Brega -Buq Buq -Sofafi -Beda -Fomm -Fuka -El Daba -Alam Halfa -El Haseiat -Er Regima -Tocra -Antelat -Msus -Charruba -El Garib -Wadi -Cuff -El Gubba -Mechili -Tengeder -Sidi Barrani -Agedabia -Barce -Cyrene - - - - - - - - + + + + + + diff --git a/play.js b/play.js index 1361789..daf45aa 100644 --- a/play.js +++ b/play.js @@ -97,6 +97,7 @@ let ui = { onmap: document.getElementById("units"), focus: null, + loaded: false, } const AXIS = 'Axis' @@ -522,6 +523,8 @@ function build_hexes() { ui.benghazi = document.getElementById("mapsvg").getElementById("fortress_benghazi") ui.bardia = document.getElementById("mapsvg").getElementById("fortress_bardia") ui.tobruk = document.getElementById("mapsvg").getElementById("fortress_tobruk") + + ui.loaded = true } function build_units() { @@ -565,7 +568,6 @@ function build_cards() { build_card(i, false) } -build_hexes() build_units() build_cards() @@ -761,6 +763,11 @@ function target_button(action) { } function on_update() { + if (!ui.loaded) { + document.getElementById("prompt").textContent = "Waiting for map..." + return setTimeout(on_update, 500) + } + update_map() update_cards() @@ -899,3 +906,17 @@ function on_log(text) { drag_element_with_mouse("#battle", "#battle_header") drag_element_with_mouse("#pursuit", "#pursuit_header") scroll_with_middle_mouse("main") + +fetch("map.svg") + .then(r => { + if (!r.ok) + throw new Error("Could not fetch \"map.svg\": " + r.statusText) + return r.text() + }) + .then(text => { + document.getElementById("mapsvg").outerHTML = text + build_hexes() + }) + .catch(error => { + window.alert(error.message) + }) diff --git a/rules.js b/rules.js index f28a8ab..0bed6aa 100644 --- a/rules.js +++ b/rules.js @@ -1,24 +1,26 @@ "use strict" +// TOOD: reveal/hide blocks (hexes) // TODO: fortress supply // TODO: oasis supply // TODO: raiders // TODO: minefields -// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack) -// TOOD: reveal/hide blocks (hexes) // TODO: group move from queue holding box to base +// TODO: legal pass withdrawal moves (reduce supply net, withdraw from fortress attack) // TODO: redeployment // TODO: return for refit // TODO: replacements // TODO: malta units -// TODO: sort blocks by type +// TODO: black hit outline in battles ("steploss/bad" action) and skip "apply 0 hits" step -// TODO: black hit outline in battles ("steploss/bad" action) +// RULES: may oasis supplied units refuse battle or withdraw to base? // RULES: may units redeploying out of battles cross enemy controlled hexsides? +// RULES: return to refit land path -- how/why check? + // RULES: when is "fired" status cleared? // RULES: disrupted units routed again in second enemy turn, will they still recover? @@ -26,7 +28,7 @@ // RULES: reveal minefields moved through (but not stopped at)? -// TODO: forbid single-group regroup moves or convert to group moves after the fact, +// ERRATA: forbid single-group regroup moves or convert to group moves after the fact, // to prevent forced march abuse. const max = Math.max -- cgit v1.2.3