From b90061cc9ca2ce29e33a2e6e8347e7ae727f97bd Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 25 Dec 2022 19:08:30 +0100 Subject: Follow 2004 edition map layout more strictly. Don't show hexsides for out-of-play hexes. Add west exit area for allied player. Remove new edition marsh. --- data.js | 8 ++++---- map.svg | 12 ------------ play.html | 1 - play.js | 13 ++++++++----- rules.js | 37 +++++++++++++++++++++++++++++++++++-- tools/gendata.js | 27 +++++++++------------------ 6 files changed, 56 insertions(+), 42 deletions(-) diff --git a/data.js b/data.js index e15ca8f..580fb65 100644 --- a/data.js +++ b/data.js @@ -1,10 +1,10 @@ // DON'T EDIT - AUTOGENERATED -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,148,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,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,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0] +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,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0] const hex_road = [0,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,1,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,1,1,2,2,2,4,4,2,4,4,4,4,4,4,4,4,4,4,4,0,0,0,4,2,2,2,2,2,0,1,2,2,2,2,0,1,0,2,0,0,0,2,0,0,0,0,0,4,2,0,1,1,0,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","39":"Gambut","40":"Bardia","47":"Exited","48":"Return for Refit","49":"Alexandria Queue","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","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","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"} +const side_limit = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,2,1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,1,0,1,1,0,0,0,0,0,0,0,1,2,2,2,1,1,0,1,2,2,2,2,2,2,2,0,0,1,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,0,1,0,2,1,0,2,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,0,1,2,0,0,2,0,2,2,0,0,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,0,0,0,0,0,0,0,0,0,1,2,0,2,2,0,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,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,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,0,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,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"} const regions = {"Libya":[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,78,79,80,81,82,83,84,85,86,87,88,103,104,105,106,107,108,109,110,111,112,113,128,129,130,131,132,133,134,135,136,137,138,151,152,153,154,155,156,157,158,159,160,161,162,176,177,178,179,180,181,182,183,184,185,186,187,200,201,202,203,204,205,206,207,208,209,210,211],"Egypt":[65,66,67,68,69,70,71,72,73,74,89,90,91,92,93,94,95,96,97,98,114,115,116,117,118,119,120,121,122,123,139,140,141,142,143,144,163,164,165,166,167,188,189,190,191,212,213,214,215],"East Line":[36,37,38,39,40,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,85,86,87,88,89,90,91,92,93,94,95,96,97,98,112,113,114,115,116,117,118,119,120,121,122,123,137,138,139,140,141,142,143,144,162,163,164,165,166,167,187,188,189,190,191],"West Line":[7,8,9,10,30,31,32,33,34,35,54,55,56,57,58,59,78,79,80,81,82,83,103,104,105,106,107,128,129,130,151,152]} const unit_name = ["Ari","Lit","Tri","Cen","Fas","Bre","Fol","Pav","Tre","Bol","Sav","Pis","Sab","Ita","15/33","21/3","90/580","15/8","21/5","15/115","21/104","90/155","90/346","90/sv288","90/200","90/361","164/382+433","Ram","164/125","88mm/A","88mm/B","50mm","76mm","/104","7","Sher/A","Sher/B","Grant","Matilda/A","Matilda/B","/1AT","1/2","1/22","7/7","10/8","/32AT","7/4","8/24","8/9","10/23","2/3","1/201G","7/22G","7/SG","1/SG","2/SG","44/131+133","51H/152","51H/154","70/14+16","70/23","44/132","6#/B","2#","6#/A","Priest","/B","/C","/D","/A","/Tob","4IN/7m","4IN/3m","10IN/161m","5IN/9+10","10IN/21+25","4IN/11","4IN/5","5IN/29","8IN/18","1SA","1SA/2+5","1SA/1","1SA/3","2SA/4+6","9AU/20","9AU/24","9AU/26","7AU/18","2NZ/4","2NZ/5","2NZ/6","FF/2","/Pol"] const unit_appearance = ["S",11,7,19,17,"S","M","S","S","S","S",19,7,"S",3,"S",5,5,"S",3,"S",3,11,11,7,5,"M","M","M",3,11,5,17,7,4,18,20,12,"T",4,4,10,8,2,16,8,4,20,20,16,"S",10,"T","T",10,"S",16,18,18,"S","S",16,18,6,12,18,14,18,20,8,"T",2,"S",14,14,14,2,2,10,14,8,6,6,8,8,"S",16,16,"T",6,6,6,14,"T"] diff --git a/map.svg b/map.svg index 093646d..72dd3e9 100644 --- a/map.svg +++ b/map.svg @@ -142,7 +142,6 @@ - El Alamein Gabr Saleh Ben Gania @@ -370,9 +364,6 @@ Matruh Marawa - Solluch Pass Halfaya @@ -424,9 +415,6 @@ Agedabia Barce Cyrene - diff --git a/play.html b/play.html index 7261280..14d9f8c 100644 --- a/play.html +++ b/play.html @@ -732,7 +732,6 @@ svg #lines line.axis_supply.allied_supply { - diff --git a/play.js b/play.js index 9dad9ff..56802ce 100644 --- a/play.js +++ b/play.js @@ -8,11 +8,11 @@ const sqrt = Math.sqrt // refit and queue hexes const MALTA = 4 -const hex_special = [ 47, 48, 49, 102, 127, MALTA ] +const hex_special = [ 47, 48, 49, 53, 102, 127, MALTA ] const unit_count = 94 -const EXIT_HEXES = [ 99, 148, 197 ] // [ 99, 123, 148 ] //, 172, 197 ] +const EXIT_HEXES = [ 99, 148, 175 ] const REFIT_HEXES = [ 48, 102 ] const BENGHAZI = 54 @@ -607,7 +607,8 @@ function build_hexes() { for (let s = 0; s < 3; ++s) { let next_id = hex_id + hexnext[s] let side_id = hex_id * 3 + s - add_line(ui.hex_x[hex_id], ui.hex_y[hex_id], s, side_id) + if (hex_exists[hex_id] || hex_exists[next_id]) + add_line(ui.hex_x[hex_id], ui.hex_y[hex_id], s, side_id) if (hex_exists[hex_id] && hex_exists[next_id]) add_path(ui.hex_x[hex_id], ui.hex_y[hex_id], ui.hex_x[next_id], ui.hex_y[next_id], side_id) } @@ -891,8 +892,10 @@ function update_map() { ui.hexes[hex].classList.toggle("axis_control", is_hex_axis_controlled(hex)) ui.hexes[hex].classList.toggle("allied_control", is_hex_allied_controlled(hex)) for (let s = 0; s < 3; ++s) { - ui.sides[hex*3+s].classList.toggle("axis_control", is_side_axis_controlled(hex*3+s)) - ui.sides[hex*3+s].classList.toggle("allied_control", is_side_allied_controlled(hex*3+s)) + if (ui.sides[hex*3+s]) { + ui.sides[hex*3+s].classList.toggle("axis_control", is_side_axis_controlled(hex*3+s)) + ui.sides[hex*3+s].classList.toggle("allied_control", is_side_allied_controlled(hex*3+s)) + } } } } diff --git a/rules.js b/rules.js index 08e38c0..7e5fc7a 100644 --- a/rules.js +++ b/rules.js @@ -907,6 +907,11 @@ function for_each_axis_unit_on_map(fn) { fn(u) } +function for_each_allied_unit(fn) { + for (let u = first_allied_unit; u <= last_allied_unit; ++u) + fn(u) +} + function for_each_allied_unit_on_map(fn) { for (let u = first_allied_unit; u <= last_allied_unit; ++u) if (is_map_hex(unit_hex(u))) @@ -6350,8 +6355,10 @@ states.axis_player_initiative = { // === VICTORY CHECK === -const EXIT_EAST_EDGE = [ 99, 148, 197 ] +const EXIT_EAST_EDGE = [ 99, 148 ] +const EXIT_WEST_EDGE = [ 175 ] const EXIT_EAST = 47 +const EXIT_WEST = 53 function check_sudden_death_victory() { // Supplied units that move beyond the map "edge" exit the map. @@ -6366,22 +6373,48 @@ function check_sudden_death_victory() { }) } + for (let x of EXIT_WEST_EDGE) { + for_each_allied_unit(u => { + if (unit_hex(u) === x && is_unit_supplied(u)) { + log(`Exited the west map edge.`) + set_unit_hex(u, EXIT_WEST) + } + }) + } + let axis_exited = 0 for_each_axis_unit(u => { if (unit_hex(u) === EXIT_EAST) axis_exited++ }) - if (is_axis_hex(ALEXANDRIA) || axis_exited >= 3) { + let allied_exited = 0 + for_each_allied_unit(u => { + if (unit_hex(u) === EXIT_WEST) + allied_exited++ + }) + + if (is_axis_hex(ALEXANDRIA)) { log_br() log("Axis captured Alexandria!") return goto_game_over(AXIS, "Axis Strategic Victory!") } + if (axis_exited >= 3) { + log_br() + log("Axis exited three supplied units!") + return goto_game_over(AXIS, "Axis Strategic Victory!") + } + if (is_allied_hex(EL_AGHEILA)) { log_br() log("Allied captured El Agheila!") return goto_game_over(ALLIED, "Allied Strategic Victory!") } + if (is_allied_hex(EL_AGHEILA) || allied_exited >= 3) { + log_br() + log("Allied exited three supplied units!") + return goto_game_over(ALLIED, "Allied Strategic Victory!") + } return false } diff --git a/tools/gendata.js b/tools/gendata.js index 492e7f2..8ee858a 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -216,22 +216,13 @@ def_offmap(0,6); def_offmap(11,29); def_offmap(41,53); def_offmap(75,77); -// def_offmap(99,102); def_offmap(100,102); // 99 is exit hex def_offmap(124,127); -// def_offmap(148,150); def_offmap(149,150); // 148 is exit hex -def_offmap(173,175); +def_offmap(173,174); def_offmap(197,199); -// def_offmap(198,199); // 197 is exit hex def_offmap(222,224); -// show spines -// def_offmap(175,175, 1); -// def_offmap(99,99, 1); -// def_offmap(148,148, 1); -// def_offmap(197,197, 1); - // depression def_offmap(168,168); def_offmap(168,168); @@ -244,15 +235,8 @@ def_offmap(200,202); def_offmap(206,212); def_offmap(214,221); -// Terrain chart hexes -// def_offmap(145,146); -// def_offmap(168,172); -// def_offmap(192,196); -// def_offmap(216,221); - // Qattara Depression and east of it -// def_offmap(145,148); -def_offmap(145,147); +def_offmap(145,146); def_offmap(168,172); def_offmap(192,196); def_offmap(216,221); @@ -378,13 +362,20 @@ hex_name = { 99: "Map Edge", 148: "Map Edge", 197: "Map Edge", + 175: "Map Edge", + 4: "Malta", 47: "Exited", + 53: "Exited", 48: "Return for Refit", 49: "Alexandria Queue", 102: "Return for Refit", 127: "El Agheila Queue", + 145: "Qattara Depression", + 146: "Qattara Depression", + 147: "Qattara Depression", + 164: "Siwa Oasis NE NW", 123: "Alexandria SW SE", } -- cgit v1.2.3