diff options
-rw-r--r-- | data.js | 264 | ||||
-rw-r--r-- | rules.js | 99 | ||||
-rw-r--r-- | tools/gendata.js | 299 |
3 files changed, 319 insertions, 343 deletions
@@ -19,150 +19,130 @@ way_port_1:[0,1,35,37,56,57,60], way_port_2:[14,15,17,19,20,21,22,24,51,58], way_port_3:[5,6,26,59], locales:[ -{"name":"Bamburgh","type":"fortress","region":"North","ways":[[1,0]],"box":{"x":637,"y":300,"w":60,"h":45},"adjacent":[1],"adjacent_by_highway":[1],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[[1,0]],"roads":[],"paths":[]}, -{"name":"Newcastle","type":"city","region":"North","ways":[[0,0],[50,1],[3,27],[2,29],[56,77]],"box":{"x":656,"y":419,"w":70,"h":77},"adjacent":[0,2,3,50,56],"adjacent_by_highway":[0,50],"adjacent_by_road":[2,3,56],"adjacent_by_path":[],"highways":[[0,0],[50,1]],"roads":[[2,29],[3,27],[56,77]],"paths":[]}, -{"name":"Appleby","type":"town","region":"North","ways":[[4,28],[1,29],[48,71]],"box":{"x":546,"y":465,"w":57,"h":52},"adjacent":[1,4,48],"adjacent_by_highway":[],"adjacent_by_road":[1,4],"adjacent_by_path":[48],"highways":[],"roads":[[1,29],[4,28]],"paths":[[48,71]]}, -{"name":"Hexham","type":"town","region":"North","ways":[[4,26],[1,27]],"box":{"x":561,"y":395,"w":53,"h":47},"adjacent":[1,4],"adjacent_by_highway":[],"adjacent_by_road":[1,4],"adjacent_by_path":[],"highways":[],"roads":[[1,27],[4,26]],"paths":[]}, -{"name":"Carlisle","type":"town","region":"North","ways":[[3,26],[2,28]],"box":{"x":436,"y":422,"w":81,"h":63},"adjacent":[2,3],"adjacent_by_highway":[],"adjacent_by_road":[2,3],"adjacent_by_path":[],"highways":[],"roads":[[2,28],[3,26]],"paths":[]}, -{"name":"Harlech","type":"harlech","region":"Wales","ways":[[47,74],[6,75]],"box":{"x":278,"y":912,"w":67,"h":61},"adjacent":[6,47],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[6,47],"highways":[],"roads":[],"paths":[[6,75],[47,74]]}, -{"name":"Pembroke","type":"fortress","region":"Wales","ways":[[5,75],[7,76]],"box":{"x":185,"y":1127,"w":58,"h":37},"adjacent":[5,7],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[5,7],"highways":[],"roads":[],"paths":[[5,75],[7,76]]}, -{"name":"Cardiff","type":"city","region":"Wales","ways":[[27,23],[6,76]],"box":{"x":392,"y":1164,"w":65,"h":65},"adjacent":[6,27],"adjacent_by_highway":[],"adjacent_by_road":[27],"adjacent_by_path":[6],"highways":[],"roads":[[27,23]],"paths":[[6,76]]}, -{"name":"Hereford","type":"city","region":"Wales","ways":[[27,12],[9,14]],"box":{"x":476,"y":1040,"w":71,"h":65},"adjacent":[9,27],"adjacent_by_highway":[9,27],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[[9,14],[27,12]],"roads":[],"paths":[]}, -{"name":"Ludlow","type":"fortress","region":"Wales","ways":[[8,14],[10,50],[46,51]],"box":{"x":476,"y":976,"w":54,"h":34},"adjacent":[8,10,46],"adjacent_by_highway":[8],"adjacent_by_road":[10,46],"adjacent_by_path":[],"highways":[[8,14]],"roads":[[10,50],[46,51]],"paths":[]}, -{"name":"Shrewsbury","type":"city","region":"Wales","ways":[[47,32],[43,33],[9,50]],"box":{"x":500,"y":865,"w":78,"h":69},"adjacent":[9,43,47],"adjacent_by_highway":[],"adjacent_by_road":[9,43,47],"adjacent_by_path":[],"highways":[],"roads":[[9,50],[43,33],[47,32]],"paths":[]}, -{"name":"Salisbury","type":"city","region":"South","ways":[[12,19],[25,20],[15,59],[29,60],[20,61]],"box":{"x":610,"y":1268,"w":73,"h":66},"adjacent":[12,15,20,25,29],"adjacent_by_highway":[12,25],"adjacent_by_road":[15,20,29],"adjacent_by_path":[],"highways":[[12,19],[25,20]],"roads":[[15,59],[20,61],[29,60]],"paths":[]}, -{"name":"Winchester","type":"city","region":"South","ways":[[13,17],[11,19],[15,58]],"box":{"x":722,"y":1262,"w":71,"h":60},"adjacent":[11,13,15],"adjacent_by_highway":[11,13],"adjacent_by_road":[15],"adjacent_by_path":[],"highways":[[11,19],[13,17]],"roads":[[15,58]],"paths":[]}, -{"name":"Guildford","type":"city","region":"South","ways":[[30,16],[12,17]],"box":{"x":841,"y":1249,"w":74,"h":59},"adjacent":[12,30],"adjacent_by_highway":[12,30],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[[12,17],[30,16]],"roads":[],"paths":[]}, -{"name":"Arundel","type":"town","region":"South","ways":[[19,56],[15,57]],"box":{"x":794,"y":1334,"w":56,"h":48},"adjacent":[15,19],"adjacent_by_highway":[],"adjacent_by_road":[15,19],"adjacent_by_path":[],"highways":[],"roads":[[15,57],[19,56]],"paths":[]}, -{"name":"Southampton","type":"town","region":"South","ways":[[14,57],[12,58],[11,59]],"box":{"x":677,"y":1371,"w":60,"h":48},"adjacent":[11,12,14],"adjacent_by_highway":[],"adjacent_by_road":[11,12,14],"adjacent_by_path":[],"highways":[],"roads":[[11,59],[12,58],[14,57]],"paths":[]}, -{"name":"Rochester","type":"city","region":"South","ways":[[19,25],[30,52],[18,53]],"box":{"x":983,"y":1185,"w":65,"h":68},"adjacent":[18,19,30],"adjacent_by_highway":[],"adjacent_by_road":[18,19,30],"adjacent_by_path":[],"highways":[],"roads":[[18,53],[19,25],[30,52]],"paths":[]}, -{"name":"Dover","type":"town","region":"South","ways":[[18,54],[19,55]],"box":{"x":1041,"y":1287,"w":53,"h":41},"adjacent":[18,19],"adjacent_by_highway":[],"adjacent_by_road":[18,19],"adjacent_by_path":[],"highways":[],"roads":[[18,54],[19,55]],"paths":[]}, -{"name":"Canterbury","type":"city","region":"South","ways":[[16,53],[17,54]],"box":{"x":1059,"y":1203,"w":66,"h":65},"adjacent":[16,17],"adjacent_by_highway":[],"adjacent_by_road":[16,17],"adjacent_by_path":[],"highways":[],"roads":[[16,53],[17,54]],"paths":[]}, -{"name":"Hastings","type":"town","region":"South","ways":[[16,25],[17,55],[14,56]],"box":{"x":983,"y":1322,"w":55,"h":46},"adjacent":[14,16,17],"adjacent_by_highway":[],"adjacent_by_road":[14,16,17],"adjacent_by_path":[],"highways":[],"roads":[[14,56],[16,25],[17,55]],"paths":[]}, -{"name":"Dorchester","type":"town","region":"England","ways":[[11,61],[25,62],[21,63]],"box":{"x":524,"y":1368,"w":58,"h":49},"adjacent":[11,21,25],"adjacent_by_highway":[],"adjacent_by_road":[11,21,25],"adjacent_by_path":[],"highways":[],"roads":[[11,61],[21,63],[25,62]],"paths":[]}, -{"name":"Exeter","type":"city","region":"England","ways":[[25,18],[20,63],[23,65],[22,67]],"box":{"x":342,"y":1376,"w":64,"h":66},"adjacent":[20,22,23,25],"adjacent_by_highway":[25],"adjacent_by_road":[20,22,23],"adjacent_by_path":[],"highways":[[25,18]],"roads":[[20,63],[22,67],[23,65]],"paths":[]}, -{"name":"Plymouth","type":"town","region":"England","ways":[[23,66],[21,67],[24,68]],"box":{"x":253,"y":1417,"w":58,"h":50},"adjacent":[21,23,24],"adjacent_by_highway":[],"adjacent_by_road":[21,23,24],"adjacent_by_path":[],"highways":[],"roads":[[21,67],[23,66],[24,68]],"paths":[]}, -{"name":"Launceston","type":"city","region":"England","ways":[[21,65],[22,66],[24,69]],"box":{"x":201,"y":1354,"w":68,"h":60},"adjacent":[21,22,24],"adjacent_by_highway":[],"adjacent_by_road":[21,22,24],"adjacent_by_path":[],"highways":[],"roads":[[21,65],[22,66],[24,69]],"paths":[]}, -{"name":"Truro","type":"town","region":"England","ways":[[22,68],[23,69]],"box":{"x":142,"y":1445,"w":56,"h":53},"adjacent":[22,23],"adjacent_by_highway":[],"adjacent_by_road":[22,23],"adjacent_by_path":[],"highways":[],"roads":[[22,68],[23,69]],"paths":[]}, -{"name":"Wells","type":"city","region":"England","ways":[[21,18],[11,20],[20,62],[26,64]],"box":{"x":504,"y":1262,"w":68,"h":66},"adjacent":[11,20,21,26],"adjacent_by_highway":[11,21],"adjacent_by_road":[20,26],"adjacent_by_path":[],"highways":[[11,20],[21,18]],"roads":[[20,62],[26,64]],"paths":[]}, -{"name":"Bristol","type":"city","region":"England","ways":[[27,15],[25,64]],"box":{"x":498,"y":1185,"w":63,"h":58},"adjacent":[25,27],"adjacent_by_highway":[27],"adjacent_by_road":[25],"adjacent_by_path":[],"highways":[[27,15]],"roads":[[25,64]],"paths":[]}, -{"name":"Gloucester","type":"city","region":"England","ways":[[28,11],[8,12],[46,13],[26,15],[7,23]],"box":{"x":564,"y":1092,"w":68,"h":62},"adjacent":[7,8,26,28,46],"adjacent_by_highway":[8,26,28,46],"adjacent_by_road":[7],"adjacent_by_path":[],"highways":[[8,12],[26,15],[28,11],[46,13]],"roads":[[7,23]],"paths":[]}, -{"name":"Oxford","type":"city","region":"England","ways":[[30,10],[27,11],[29,24],[40,48]],"box":{"x":707,"y":1101,"w":70,"h":63},"adjacent":[27,29,30,40],"adjacent_by_highway":[27,30],"adjacent_by_road":[29,40],"adjacent_by_path":[],"highways":[[27,11],[30,10]],"roads":[[29,24],[40,48]],"paths":[]}, -{"name":"Newbury","type":"town","region":"England","ways":[[28,24],[11,60]],"box":{"x":665,"y":1194,"w":66,"h":44},"adjacent":[11,28],"adjacent_by_highway":[],"adjacent_by_road":[11,28],"adjacent_by_path":[],"highways":[],"roads":[[11,60],[28,24]],"paths":[]}, -{"name":"London","type":"london","region":"England","ways":[[31,9],[28,10],[13,16],[16,52]],"box":{"x":874,"y":1164,"w":94,"h":72},"adjacent":[13,16,28,31],"adjacent_by_highway":[13,28,31],"adjacent_by_road":[16],"adjacent_by_path":[],"highways":[[13,16],[28,10],[31,9]],"roads":[[16,52]],"paths":[]}, -{"name":"St Albans","type":"town","region":"England","ways":[[32,7],[33,8],[30,9],[35,43]],"box":{"x":901,"y":1092,"w":54,"h":40},"adjacent":[30,32,33,35],"adjacent_by_highway":[30,32,33],"adjacent_by_road":[35],"adjacent_by_path":[],"highways":[[30,9],[32,7],[33,8]],"roads":[[35,43]],"paths":[]}, -{"name":"Bedford","type":"town","region":"England","ways":[[31,7],[40,22],[33,45]],"box":{"x":836,"y":1044,"w":65,"h":48},"adjacent":[31,33,40],"adjacent_by_highway":[31,40],"adjacent_by_road":[33],"adjacent_by_path":[],"highways":[[31,7],[40,22]],"roads":[[33,45]],"paths":[]}, -{"name":"Cambridge","type":"town","region":"England","ways":[[31,8],[38,21],[34,44],[32,45]],"box":{"x":901,"y":1021,"w":54,"h":45},"adjacent":[31,32,34,38],"adjacent_by_highway":[31,38],"adjacent_by_road":[32,34],"adjacent_by_path":[],"highways":[[31,8],[38,21]],"roads":[[32,45],[34,44]],"paths":[]}, -{"name":"Bury St Edmunds","type":"town","region":"England","ways":[[38,38],[36,39],[35,42],[33,44]],"box":{"x":997,"y":995,"w":54,"h":45},"adjacent":[33,35,36,38],"adjacent_by_highway":[],"adjacent_by_road":[33,35,36,38],"adjacent_by_path":[],"highways":[],"roads":[[33,44],[35,42],[36,39],[38,38]],"paths":[]}, -{"name":"Ipswich","type":"town","region":"England","ways":[[36,41],[34,42],[31,43]],"box":{"x":1100,"y":1030,"w":58,"h":43},"adjacent":[31,34,36],"adjacent_by_highway":[],"adjacent_by_road":[31,34,36],"adjacent_by_path":[],"highways":[],"roads":[[31,43],[34,42],[36,41]],"paths":[]}, -{"name":"Norwich","type":"city","region":"England","ways":[[34,39],[37,40],[35,41]],"box":{"x":1059,"y":890,"w":67,"h":62},"adjacent":[34,35,37],"adjacent_by_highway":[],"adjacent_by_road":[34,35,37],"adjacent_by_path":[],"highways":[],"roads":[[34,39],[35,41],[37,40]],"paths":[]}, -{"name":"Lynn","type":"fortress","region":"England","ways":[[38,37],[36,40]],"box":{"x":962,"y":895,"w":47,"h":38},"adjacent":[36,38],"adjacent_by_highway":[],"adjacent_by_road":[36,38],"adjacent_by_path":[],"highways":[],"roads":[[36,40],[38,37]],"paths":[]}, -{"name":"Ely","type":"city","region":"England","ways":[[39,4],[33,21],[37,37],[34,38]],"box":{"x":921,"y":952,"w":65,"h":66},"adjacent":[33,34,37,39],"adjacent_by_highway":[33,39],"adjacent_by_road":[34,37],"adjacent_by_path":[],"highways":[[33,21],[39,4]],"roads":[[34,38],[37,37]],"paths":[]}, -{"name":"Peterborough","type":"city","region":"England","ways":[[49,3],[38,4],[42,36],[40,46]],"box":{"x":828,"y":930,"w":66,"h":62},"adjacent":[38,40,42,49],"adjacent_by_highway":[38,49],"adjacent_by_road":[40,42],"adjacent_by_path":[],"highways":[[38,4],[49,3]],"roads":[[40,46],[42,36]],"paths":[]}, -{"name":"Northampton","type":"town","region":"England","ways":[[42,6],[32,22],[39,46],[41,47],[28,48]],"box":{"x":748,"y":1013,"w":64,"h":54},"adjacent":[28,32,39,41,42],"adjacent_by_highway":[32,42],"adjacent_by_road":[28,39,41],"adjacent_by_path":[],"highways":[[32,22],[42,6]],"roads":[[28,48],[39,46],[41,47]],"paths":[]}, -{"name":"Coventry","type":"city","region":"England","ways":[[43,35],[40,47]],"box":{"x":675,"y":967,"w":67,"h":63},"adjacent":[40,43],"adjacent_by_highway":[],"adjacent_by_road":[40,43],"adjacent_by_path":[],"highways":[],"roads":[[40,47],[43,35]],"paths":[]}, -{"name":"Leicester","type":"town","region":"England","ways":[[45,5],[40,6],[43,34],[39,36]],"box":{"x":758,"y":906,"w":49,"h":46},"adjacent":[39,40,43,45],"adjacent_by_highway":[40,45],"adjacent_by_road":[39,43],"adjacent_by_path":[],"highways":[[40,6],[45,5]],"roads":[[39,36],[43,34]],"paths":[]}, -{"name":"Lichfield","type":"city","region":"England","ways":[[10,33],[42,34],[41,35],[46,49],[44,70]],"box":{"x":613,"y":906,"w":74,"h":61},"adjacent":[10,41,42,44,46],"adjacent_by_highway":[],"adjacent_by_road":[10,41,42,44,46],"adjacent_by_path":[],"highways":[],"roads":[[10,33],[41,35],[42,34],[44,70],[46,49]],"paths":[]}, -{"name":"Derby","type":"town","region":"England","ways":[[45,31],[43,70]],"box":{"x":656,"y":845,"w":62,"h":49},"adjacent":[43,45],"adjacent_by_highway":[],"adjacent_by_road":[43,45],"adjacent_by_path":[],"highways":[],"roads":[[43,70],[45,31]],"paths":[]}, -{"name":"Nottingham","type":"town","region":"England","ways":[[42,5],[49,30],[44,31]],"box":{"x":718,"y":845,"w":73,"h":40},"adjacent":[42,44,49],"adjacent_by_highway":[42],"adjacent_by_road":[44,49],"adjacent_by_path":[],"highways":[[42,5]],"roads":[[44,31],[49,30]],"paths":[]}, -{"name":"Worcester","type":"city","region":"England","ways":[[27,13],[43,49],[9,51]],"box":{"x":556,"y":992,"w":72,"h":64},"adjacent":[9,27,43],"adjacent_by_highway":[27],"adjacent_by_road":[9,43],"adjacent_by_path":[],"highways":[[27,13]],"roads":[[9,51],[43,49]],"paths":[]}, -{"name":"Chester","type":"city","region":"England","ways":[[10,32],[48,72],[50,73],[5,74]],"box":{"x":433,"y":797,"w":78,"h":64},"adjacent":[5,10,48,50],"adjacent_by_highway":[],"adjacent_by_road":[10],"adjacent_by_path":[5,48,50],"highways":[],"roads":[[10,32]],"paths":[[5,74],[48,72],[50,73]]}, -{"name":"Lancaster","type":"town","region":"England","ways":[[2,71],[47,72]],"box":{"x":476,"y":595,"w":70,"h":51},"adjacent":[2,47],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[2,47],"highways":[],"roads":[],"paths":[[2,71],[47,72]]}, -{"name":"Lincoln","type":"city","region":"England","ways":[[50,2],[39,3],[45,30],[57,80]],"box":{"x":767,"y":760,"w":78,"h":64},"adjacent":[39,45,50,57],"adjacent_by_highway":[39,50],"adjacent_by_road":[45,57],"adjacent_by_path":[],"highways":[[39,3],[50,2]],"roads":[[45,30],[57,80]],"paths":[]}, -{"name":"York","type":"city","region":"England","ways":[[1,1],[49,2],[47,73],[56,78],[57,79]],"box":{"x":691,"y":623,"w":76,"h":65},"adjacent":[1,47,49,56,57],"adjacent_by_highway":[1,49],"adjacent_by_road":[56,57],"adjacent_by_path":[47],"highways":[[1,1],[49,2]],"roads":[[56,78],[57,79]],"paths":[[47,73]]}, -{"name":"Calais","type":"calais","region":"England","ways":[],"box":{"x":1134,"y":1418,"w":67,"h":79},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"France","type":"exile","region":"England","ways":[],"box":{"x":890,"y":1430,"w":109,"h":114},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"Scotland","type":"exile","region":"England","ways":[],"box":{"x":450,"y":278,"w":111,"h":118},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"Ireland","type":"exile","region":"England","ways":[],"box":{"x":50,"y":949,"w":110,"h":121},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"Burgundy","type":"exile","region":"England","ways":[],"box":{"x":996,"y":688,"w":110,"h":121},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"Scarborough","type":"town","region":"North","ways":[[1,77],[50,78]],"box":{"x":791,"y":532,"w":78,"h":57},"adjacent":[1,50],"adjacent_by_highway":[],"adjacent_by_road":[1,50],"adjacent_by_path":[],"highways":[],"roads":[[1,77],[50,78]],"paths":[]}, -{"name":"Ravenspur","type":"fortress","region":"England","ways":[[50,79],[49,80]],"box":{"x":835,"y":721,"w":72,"h":45},"adjacent":[49,50],"adjacent_by_highway":[],"adjacent_by_road":[49,50],"adjacent_by_path":[],"highways":[],"roads":[[49,80],[50,79]],"paths":[]}, -{"name":"English Channel","type":"sea","region":"England","ways":[],"box":{"x":564,"y":1461,"w":173,"h":69},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"Irish Sea","type":"sea","region":"England","ways":[],"box":{"x":233,"y":667,"w":160,"h":93},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, -{"name":"North Sea","type":"sea","region":"England","ways":[],"box":{"x":1106,"y":749,"w":97,"h":117},"adjacent":[],"adjacent_by_highway":[],"adjacent_by_road":[],"adjacent_by_path":[],"highways":[],"roads":[],"paths":[]}, +{"name":"Bamburgh","type":"fortress","region":"North","adjacent":[1],"highways":[1],"roads":[],"paths":[],"not_paths":[1],"box":{"x":637,"y":300,"w":60,"h":45}}, +{"name":"Newcastle","type":"city","region":"North","adjacent":[0,2,3,50,56],"highways":[0,50],"roads":[2,3,56],"paths":[],"not_paths":[0,2,3,50,56],"box":{"x":656,"y":419,"w":70,"h":77}}, +{"name":"Appleby","type":"town","region":"North","adjacent":[1,4,48],"highways":[],"roads":[1,4],"paths":[48],"not_paths":[1,4],"box":{"x":546,"y":465,"w":57,"h":52}}, +{"name":"Hexham","type":"town","region":"North","adjacent":[1,4],"highways":[],"roads":[1,4],"paths":[],"not_paths":[1,4],"box":{"x":561,"y":395,"w":53,"h":47}}, +{"name":"Carlisle","type":"town","region":"North","adjacent":[2,3],"highways":[],"roads":[2,3],"paths":[],"not_paths":[2,3],"box":{"x":436,"y":422,"w":81,"h":63}}, +{"name":"Harlech","type":"harlech","region":"Wales","adjacent":[6,47],"highways":[],"roads":[],"paths":[6,47],"not_paths":[],"box":{"x":278,"y":912,"w":67,"h":61}}, +{"name":"Pembroke","type":"fortress","region":"Wales","adjacent":[5,7],"highways":[],"roads":[],"paths":[5,7],"not_paths":[],"box":{"x":185,"y":1127,"w":58,"h":37}}, +{"name":"Cardiff","type":"city","region":"Wales","adjacent":[6,27],"highways":[],"roads":[27],"paths":[6],"not_paths":[27],"box":{"x":392,"y":1164,"w":65,"h":65}}, +{"name":"Hereford","type":"city","region":"Wales","adjacent":[9,27],"highways":[9,27],"roads":[],"paths":[],"not_paths":[9,27],"box":{"x":476,"y":1040,"w":71,"h":65}}, +{"name":"Ludlow","type":"fortress","region":"Wales","adjacent":[8,10,46],"highways":[8],"roads":[10,46],"paths":[],"not_paths":[8,10,46],"box":{"x":476,"y":976,"w":54,"h":34}}, +{"name":"Shrewsbury","type":"city","region":"Wales","adjacent":[9,43,47],"highways":[],"roads":[9,43,47],"paths":[],"not_paths":[9,43,47],"box":{"x":500,"y":865,"w":78,"h":69}}, +{"name":"Salisbury","type":"city","region":"South","adjacent":[12,15,20,25,29],"highways":[12,25],"roads":[15,20,29],"paths":[],"not_paths":[12,15,20,25,29],"box":{"x":610,"y":1268,"w":73,"h":66}}, +{"name":"Winchester","type":"city","region":"South","adjacent":[11,13,15],"highways":[11,13],"roads":[15],"paths":[],"not_paths":[11,13,15],"box":{"x":722,"y":1262,"w":71,"h":60}}, +{"name":"Guildford","type":"city","region":"South","adjacent":[12,30],"highways":[12,30],"roads":[],"paths":[],"not_paths":[12,30],"box":{"x":841,"y":1249,"w":74,"h":59}}, +{"name":"Arundel","type":"town","region":"South","adjacent":[15,19],"highways":[],"roads":[15,19],"paths":[],"not_paths":[15,19],"box":{"x":794,"y":1334,"w":56,"h":48}}, +{"name":"Southampton","type":"town","region":"South","adjacent":[11,12,14],"highways":[],"roads":[11,12,14],"paths":[],"not_paths":[11,12,14],"box":{"x":677,"y":1371,"w":60,"h":48}}, +{"name":"Rochester","type":"city","region":"South","adjacent":[18,19,30],"highways":[],"roads":[18,19,30],"paths":[],"not_paths":[18,19,30],"box":{"x":983,"y":1185,"w":65,"h":68}}, +{"name":"Dover","type":"town","region":"South","adjacent":[18,19],"highways":[],"roads":[18,19],"paths":[],"not_paths":[18,19],"box":{"x":1041,"y":1287,"w":53,"h":41}}, +{"name":"Canterbury","type":"city","region":"South","adjacent":[16,17],"highways":[],"roads":[16,17],"paths":[],"not_paths":[16,17],"box":{"x":1059,"y":1203,"w":66,"h":65}}, +{"name":"Hastings","type":"town","region":"South","adjacent":[14,16,17],"highways":[],"roads":[14,16,17],"paths":[],"not_paths":[14,16,17],"box":{"x":983,"y":1322,"w":55,"h":46}}, +{"name":"Dorchester","type":"town","region":"England","adjacent":[11,21,25],"highways":[],"roads":[11,21,25],"paths":[],"not_paths":[11,21,25],"box":{"x":524,"y":1368,"w":58,"h":49}}, +{"name":"Exeter","type":"city","region":"England","adjacent":[20,22,23,25],"highways":[25],"roads":[20,22,23],"paths":[],"not_paths":[20,22,23,25],"box":{"x":342,"y":1376,"w":64,"h":66}}, +{"name":"Plymouth","type":"town","region":"England","adjacent":[21,23,24],"highways":[],"roads":[21,23,24],"paths":[],"not_paths":[21,23,24],"box":{"x":253,"y":1417,"w":58,"h":50}}, +{"name":"Launceston","type":"city","region":"England","adjacent":[21,22,24],"highways":[],"roads":[21,22,24],"paths":[],"not_paths":[21,22,24],"box":{"x":201,"y":1354,"w":68,"h":60}}, +{"name":"Truro","type":"town","region":"England","adjacent":[22,23],"highways":[],"roads":[22,23],"paths":[],"not_paths":[22,23],"box":{"x":142,"y":1445,"w":56,"h":53}}, +{"name":"Wells","type":"city","region":"England","adjacent":[11,20,21,26],"highways":[11,21],"roads":[20,26],"paths":[],"not_paths":[11,20,21,26],"box":{"x":504,"y":1262,"w":68,"h":66}}, +{"name":"Bristol","type":"city","region":"England","adjacent":[25,27],"highways":[27],"roads":[25],"paths":[],"not_paths":[25,27],"box":{"x":498,"y":1185,"w":63,"h":58}}, +{"name":"Gloucester","type":"city","region":"England","adjacent":[7,8,26,28,46],"highways":[8,26,28,46],"roads":[7],"paths":[],"not_paths":[7,8,26,28,46],"box":{"x":564,"y":1092,"w":68,"h":62}}, +{"name":"Oxford","type":"city","region":"England","adjacent":[27,29,30,40],"highways":[27,30],"roads":[29,40],"paths":[],"not_paths":[27,29,30,40],"box":{"x":707,"y":1101,"w":70,"h":63}}, +{"name":"Newbury","type":"town","region":"England","adjacent":[11,28],"highways":[],"roads":[11,28],"paths":[],"not_paths":[11,28],"box":{"x":665,"y":1194,"w":66,"h":44}}, +{"name":"London","type":"london","region":"England","adjacent":[13,16,28,31],"highways":[13,28,31],"roads":[16],"paths":[],"not_paths":[13,16,28,31],"box":{"x":874,"y":1164,"w":94,"h":72}}, +{"name":"St Albans","type":"town","region":"England","adjacent":[30,32,33,35],"highways":[30,32,33],"roads":[35],"paths":[],"not_paths":[30,32,33,35],"box":{"x":901,"y":1092,"w":54,"h":40}}, +{"name":"Bedford","type":"town","region":"England","adjacent":[31,33,40],"highways":[31,40],"roads":[33],"paths":[],"not_paths":[31,33,40],"box":{"x":836,"y":1044,"w":65,"h":48}}, +{"name":"Cambridge","type":"town","region":"England","adjacent":[31,32,34,38],"highways":[31,38],"roads":[32,34],"paths":[],"not_paths":[31,32,34,38],"box":{"x":901,"y":1021,"w":54,"h":45}}, +{"name":"Bury St Edmunds","type":"town","region":"England","adjacent":[33,35,36,38],"highways":[],"roads":[33,35,36,38],"paths":[],"not_paths":[33,35,36,38],"box":{"x":997,"y":995,"w":54,"h":45}}, +{"name":"Ipswich","type":"town","region":"England","adjacent":[31,34,36],"highways":[],"roads":[31,34,36],"paths":[],"not_paths":[31,34,36],"box":{"x":1100,"y":1030,"w":58,"h":43}}, +{"name":"Norwich","type":"city","region":"England","adjacent":[34,35,37],"highways":[],"roads":[34,35,37],"paths":[],"not_paths":[34,35,37],"box":{"x":1059,"y":890,"w":67,"h":62}}, +{"name":"Lynn","type":"fortress","region":"England","adjacent":[36,38],"highways":[],"roads":[36,38],"paths":[],"not_paths":[36,38],"box":{"x":962,"y":895,"w":47,"h":38}}, +{"name":"Ely","type":"city","region":"England","adjacent":[33,34,37,39],"highways":[33,39],"roads":[34,37],"paths":[],"not_paths":[33,34,37,39],"box":{"x":921,"y":952,"w":65,"h":66}}, +{"name":"Peterborough","type":"city","region":"England","adjacent":[38,40,42,49],"highways":[38,49],"roads":[40,42],"paths":[],"not_paths":[38,40,42,49],"box":{"x":828,"y":930,"w":66,"h":62}}, +{"name":"Northampton","type":"town","region":"England","adjacent":[28,32,39,41,42],"highways":[32,42],"roads":[28,39,41],"paths":[],"not_paths":[28,32,39,41,42],"box":{"x":748,"y":1013,"w":64,"h":54}}, +{"name":"Coventry","type":"city","region":"England","adjacent":[40,43],"highways":[],"roads":[40,43],"paths":[],"not_paths":[40,43],"box":{"x":675,"y":967,"w":67,"h":63}}, +{"name":"Leicester","type":"town","region":"England","adjacent":[39,40,43,45],"highways":[40,45],"roads":[39,43],"paths":[],"not_paths":[39,40,43,45],"box":{"x":758,"y":906,"w":49,"h":46}}, +{"name":"Lichfield","type":"city","region":"England","adjacent":[10,41,42,44,46],"highways":[],"roads":[10,41,42,44,46],"paths":[],"not_paths":[10,41,42,44,46],"box":{"x":613,"y":906,"w":74,"h":61}}, +{"name":"Derby","type":"town","region":"England","adjacent":[43,45],"highways":[],"roads":[43,45],"paths":[],"not_paths":[43,45],"box":{"x":656,"y":845,"w":62,"h":49}}, +{"name":"Nottingham","type":"town","region":"England","adjacent":[42,44,49],"highways":[42],"roads":[44,49],"paths":[],"not_paths":[42,44,49],"box":{"x":718,"y":845,"w":73,"h":40}}, +{"name":"Worcester","type":"city","region":"England","adjacent":[9,27,43],"highways":[27],"roads":[9,43],"paths":[],"not_paths":[9,27,43],"box":{"x":556,"y":992,"w":72,"h":64}}, +{"name":"Chester","type":"city","region":"England","adjacent":[5,10,48,50],"highways":[],"roads":[10],"paths":[5,48,50],"not_paths":[10],"box":{"x":433,"y":797,"w":78,"h":64}}, +{"name":"Lancaster","type":"town","region":"England","adjacent":[2,47],"highways":[],"roads":[],"paths":[2,47],"not_paths":[],"box":{"x":476,"y":595,"w":70,"h":51}}, +{"name":"Lincoln","type":"city","region":"England","adjacent":[39,45,50,57],"highways":[39,50],"roads":[45,57],"paths":[],"not_paths":[39,45,50,57],"box":{"x":767,"y":760,"w":78,"h":64}}, +{"name":"York","type":"city","region":"England","adjacent":[1,47,49,56,57],"highways":[1,49],"roads":[56,57],"paths":[47],"not_paths":[1,49,56,57],"box":{"x":691,"y":623,"w":76,"h":65}}, +{"name":"Calais","type":"calais","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":1134,"y":1418,"w":67,"h":79}}, +{"name":"France","type":"exile","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":890,"y":1430,"w":109,"h":114}}, +{"name":"Scotland","type":"exile","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":450,"y":278,"w":111,"h":118}}, +{"name":"Ireland","type":"exile","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":50,"y":949,"w":110,"h":121}}, +{"name":"Burgundy","type":"exile","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":996,"y":688,"w":110,"h":121}}, +{"name":"Scarborough","type":"town","region":"North","adjacent":[1,50],"highways":[],"roads":[1,50],"paths":[],"not_paths":[1,50],"box":{"x":791,"y":532,"w":78,"h":57}}, +{"name":"Ravenspur","type":"fortress","region":"England","adjacent":[49,50],"highways":[],"roads":[49,50],"paths":[],"not_paths":[49,50],"box":{"x":835,"y":721,"w":72,"h":45}}, +{"name":"English Channel","type":"sea","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":564,"y":1461,"w":173,"h":69}}, +{"name":"Irish Sea","type":"sea","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":233,"y":667,"w":160,"h":93}}, +{"name":"North Sea","type":"sea","region":"England","adjacent":[],"highways":[],"roads":[],"paths":[],"not_paths":[],"box":{"x":1106,"y":749,"w":97,"h":117}}, ], ways:[ -{"type":"highway","locales":[0,1]}, -{"type":"highway","locales":[1,50]}, -{"type":"highway","locales":[49,50]}, -{"type":"highway","locales":[39,49]}, -{"type":"highway","locales":[38,39]}, -{"type":"highway","locales":[42,45]}, -{"type":"highway","locales":[40,42]}, -{"type":"highway","locales":[31,32]}, -{"type":"highway","locales":[31,33]}, -{"type":"highway","locales":[30,31]}, -{"type":"highway","locales":[28,30]}, -{"type":"highway","locales":[27,28]}, -{"type":"highway","locales":[8,27]}, -{"type":"highway","locales":[27,46]}, -{"type":"highway","locales":[8,9]}, -{"type":"highway","locales":[26,27]}, -{"type":"highway","locales":[13,30]}, -{"type":"highway","locales":[12,13]}, -{"type":"highway","locales":[21,25]}, -{"type":"highway","locales":[11,12]}, -{"type":"highway","locales":[11,25]}, -{"type":"highway","locales":[33,38]}, -{"type":"highway","locales":[32,40]}, -{"type":"road","locales":[7,27]}, -{"type":"road","locales":[28,29]}, -{"type":"road","locales":[16,19]}, -{"type":"road","locales":[3,4]}, -{"type":"road","locales":[1,3]}, -{"type":"road","locales":[2,4]}, -{"type":"road","locales":[1,2]}, -{"type":"road","locales":[45,49]}, -{"type":"road","locales":[44,45]}, -{"type":"road","locales":[10,47]}, -{"type":"road","locales":[10,43]}, -{"type":"road","locales":[42,43]}, -{"type":"road","locales":[41,43]}, -{"type":"road","locales":[39,42]}, -{"type":"road","locales":[37,38]}, -{"type":"road","locales":[34,38]}, -{"type":"road","locales":[34,36]}, -{"type":"road","locales":[36,37]}, -{"type":"road","locales":[35,36]}, -{"type":"road","locales":[34,35]}, -{"type":"road","locales":[31,35]}, -{"type":"road","locales":[33,34]}, -{"type":"road","locales":[32,33]}, -{"type":"road","locales":[39,40]}, -{"type":"road","locales":[40,41]}, -{"type":"road","locales":[28,40]}, -{"type":"road","locales":[43,46]}, -{"type":"road","locales":[9,10]}, -{"type":"road","locales":[9,46]}, -{"type":"road","locales":[16,30]}, -{"type":"road","locales":[16,18]}, -{"type":"road","locales":[17,18]}, -{"type":"road","locales":[17,19]}, -{"type":"road","locales":[14,19]}, -{"type":"road","locales":[14,15]}, -{"type":"road","locales":[12,15]}, -{"type":"road","locales":[11,15]}, -{"type":"road","locales":[11,29]}, -{"type":"road","locales":[11,20]}, -{"type":"road","locales":[20,25]}, -{"type":"road","locales":[20,21]}, -{"type":"road","locales":[25,26]}, -{"type":"road","locales":[21,23]}, -{"type":"road","locales":[22,23]}, -{"type":"road","locales":[21,22]}, -{"type":"road","locales":[22,24]}, -{"type":"road","locales":[23,24]}, -{"type":"road","locales":[43,44]}, -{"type":"path","locales":[2,48]}, -{"type":"path","locales":[47,48]}, -{"type":"path","locales":[47,50]}, -{"type":"path","locales":[5,47]}, -{"type":"path","locales":[5,6]}, -{"type":"path","locales":[6,7]}, -{"type":"road","locales":[1,56]}, -{"type":"road","locales":[50,56]}, -{"type":"road","locales":[50,57]}, -{"type":"road","locales":[49,57]}, +[1,"highway"], +[0,"highway",2,"road",3,"road",50,"highway",56,"road"], +[1,"road",4,"road",48,"path"], +[1,"road",4,"road"], +[2,"road",3,"road"], +[6,"path",47,"path"], +[5,"path",7,"path"], +[6,"path",27,"road"], +[9,"highway",27,"highway"], +[8,"highway",10,"road",46,"road"], +[9,"road",43,"road",47,"road"], +[12,"highway",15,"road",20,"road",25,"highway",29,"road"], +[11,"highway",13,"highway",15,"road"], +[12,"highway",30,"highway"], +[15,"road",19,"road"], +[11,"road",12,"road",14,"road"], +[18,"road",19,"road",30,"road"], +[18,"road",19,"road"], +[16,"road",17,"road"], +[14,"road",16,"road",17,"road"], +[11,"road",21,"road",25,"road"], +[20,"road",22,"road",23,"road",25,"highway"], +[21,"road",23,"road",24,"road"], +[21,"road",22,"road",24,"road"], +[22,"road",23,"road"], +[11,"highway",20,"road",21,"highway",26,"road"], +[25,"road",27,"highway"], +[7,"road",8,"highway",26,"highway",28,"highway",46,"highway"], +[27,"highway",29,"road",30,"highway",40,"road"], +[11,"road",28,"road"], +[13,"highway",16,"road",28,"highway",31,"highway"], +[30,"highway",32,"highway",33,"highway",35,"road"], +[31,"highway",33,"road",40,"highway"], +[31,"highway",32,"road",34,"road",38,"highway"], +[33,"road",35,"road",36,"road",38,"road"], +[31,"road",34,"road",36,"road"], +[34,"road",35,"road",37,"road"], +[36,"road",38,"road"], +[33,"highway",34,"road",37,"road",39,"highway"], +[38,"highway",40,"road",42,"road",49,"highway"], +[28,"road",32,"highway",39,"road",41,"road",42,"highway"], +[40,"road",43,"road"], +[39,"road",40,"highway",43,"road",45,"highway"], +[10,"road",41,"road",42,"road",44,"road",46,"road"], +[43,"road",45,"road"], +[42,"highway",44,"road",49,"road"], +[9,"road",27,"highway",43,"road"], +[5,"path",10,"road",48,"path",50,"path"], +[2,"path",47,"path"], +[39,"highway",45,"road",50,"highway",57,"road"], +[1,"highway",47,"path",49,"highway",56,"road",57,"road"], +[], +[], +[], +[], +[], +[1,"road",50,"road"], +[49,"road",50,"road"], +[], +[], +[], ], lords:[ {"side":"York","name":"York","full_name":"Richard Plantagenet","title":"Duke of York","seats":[38],"marshal":2,"influence":5,"lordship":3,"command":2,"valour":2,"forces":{"retinue":1,"men_at_arms":2,"longbowmen":2,"militia":2},"assets":{"cart":2,"prov":2,"coin":2},"ships":0,"id":"lord_york"}, @@ -1632,13 +1632,6 @@ function get_lord_provender(lord) { return get_lord_assets(lord, PROV) } -function list_ways(from, to) { - for (let ways of data.locales[from].ways) - if (ways[0] === to) - return ways - return null -} - function group_has_capability(c) { for (let lord of game.group) if (lord_has_capability(lord, c)) @@ -3700,6 +3693,10 @@ states.levy_muster_vassal = { // === ACTION: MARCH === +function get_way_type(from, to) { + return map_get(data.ways[from], to) +} + function format_group_move() { if (game.group.length > 1) { let list = [] @@ -3713,20 +3710,22 @@ function format_group_move() { function prompt_march() { let from = get_lord_locale(game.command) - if (is_first_action()) - for (let to of data.locales[from].adjacent_by_path) { + + if (is_first_action()) { + for (let to of data.locales[from].paths) { gen_action_locale(to) } + } if (game.actions > 0) { - for (let to of data.locales[from].adjacent_by_road) { + for (let to of data.locales[from].roads) { gen_action_locale(to) } - for (let to of data.locales[from].adjacent_by_highway) { + for (let to of data.locales[from].highways) { gen_action_locale(to) } } else if (game.actions === 0 && is_first_march_highway()) { - for (let to of data.locales[from].adjacent_by_highway) { + for (let to of data.locales[from].highways) { gen_action_locale(to) } } @@ -3737,7 +3736,7 @@ function prompt_march() { is_first_march_highway() && count_group_lords() === 1 ) { - for (let to of data.locales[from].adjacent_by_road) { + for (let to of data.locales[from].roads) { gen_action_locale(to) } } @@ -3746,17 +3745,13 @@ function prompt_march() { function goto_march(to) { push_undo() let from = get_lord_locale(game.command) - let ways = list_ways(from, to) - game.march = { from, to, approach: ways[1], avoid: -1 } + game.march = { from, to, avoid: -1 } march_with_group_1() } function march_with_group_1() { let transport = count_group_assets(CART) let prov = count_group_assets(PROV) - if (prov <= transport) - return march_with_group_2() - if (prov > transport) game.state = "march_laden" else @@ -3795,30 +3790,37 @@ states.march_laden = { } function march_with_group_2() { - let way = game.march.approach + let from = game.march.from let to = game.march.to - let way_type = data.ways[way].type + let type = get_way_type(from, to) + let alone = count_group_lords() === 1 - if ( - (way_type === "highway" && is_first_march_highway()) || - (is_first_march_highway() && way_type === "road" && count_group_lords() === 1) - ) { - spend_march_action(0) - } else if (way_type === "highway") { - spend_march_action(1) - game.flags.first_march_highway = 1 - } else if (way_type === "road") { - spend_march_action(1) - if (lord_has_capability(game.command, AOW_YORK_YORKISTS_NEVER_WAIT) && count_group_lords() === 1) - game.flags.first_march_highway = 1 - } else if (way_type === "path") { - spend_all_actions() + switch (type) { + case "highway": + if (is_first_march_highway()) { + spend_march_action(0) + } else { + spend_march_action(1) + game.flags.first_march_highway = 1 + } + break + + case "road": + if (alone && is_first_march_highway()) { + spend_march_action(0) + } else { + spend_march_action(1) + if (alone && lord_has_capability(game.command, AOW_YORK_YORKISTS_NEVER_WAIT)) + game.flags.first_march_highway = 1 + } + break + + case "path": + spend_all_actions() + break } - if (data.ways[way].name) - log(`Marched to %${to} via W${way}${format_group_move()}.`) - else - log(`Marched to %${to}${format_group_move()}.`) + log(`Marched to %${to}${format_group_move()}.`) for (let lord of game.group) { set_lord_locale(lord, to) @@ -3843,20 +3845,10 @@ function march_with_group_3() { // === Interception === -function find_way(loc1, loc2) { - for (let way of data.ways) { - if (way.locales.includes(loc1) && way.locales.includes(loc2)) { - return way - } - } - return null -} - function goto_intercept() { let here = get_lord_locale(game.command) - for (let loc of data.locales[here].adjacent) { - let way = find_way(here, loc) - if (has_enemy_lord(loc) && way !== null && way.type !== "path") { + for (let next of data.locales[here].not_paths) { + if (has_enemy_lord(next)) { game.state = "intercept" set_active_enemy() game.intercept_group = [] @@ -3882,11 +3874,8 @@ states.intercept = { let to = get_lord_locale(game.command) if (game.who === NOBODY) { - for (let loc of data.locales[to].adjacent) { - let way = find_way(to, loc) - if (way !== null && way.type !== "path") - for_each_friendly_lord_in_locale(loc, gen_action_lord) - } + for (let next of data.locales[to].not_paths) + for_each_friendly_lord_in_locale(next, gen_action_lord) } else { gen_action_lord(game.who) if (is_marshal(game.who) || is_lieutenant(game.who)) { diff --git a/tools/gendata.js b/tools/gendata.js index 6d4850a..07d67e3 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -5,12 +5,38 @@ const fs = require('fs') function cmpnum(a,b) { return a - b } -function cmpnum2(a,b) { return a[0] - b[0] } function clean_name(name) { return name.toLowerCase().replaceAll("&", "and").replaceAll(" ", "_") } +function array_insert_pair(array, index, key, value) { + for (let i = array.length; i > index; i -= 2) { + array[i] = array[i-2] + array[i+1] = array[i-1] + } + array[index] = key + array[index+1] = value +} + +function map_set(map, key, value) { + let a = 0 + let b = (map.length >> 1) - 1 + while (a <= b) { + let m = (a + b) >> 1 + let x = map[m<<1] + if (key < x) + b = m - 1 + else if (key > x) + a = m + 1 + else { + map[(m<<1)+1] = value + return + } + } + array_insert_pair(map, a<<1, key, value) +} + // :r !node tools/genboxes.js const boxes = { "0": [22,1575,48,48], @@ -306,9 +332,6 @@ var locmap = {} // 0=offmap, 1-N=map locales, 100-M=calendar boxes var locales = [] var ways = [] -var highways = [] -var roads = [] -var paths = [] var deplete = [] var favour = [] var seat = [] @@ -323,7 +346,8 @@ function defloc(region, type, name) { w = Math.ceil(w) h = Math.ceil(h) locmap[name] = locales.length - locales.push({ name, type, region, ways: [], box: { x, y, w, h } }) + locales.push({ name, type, region, adjacent: [], highways: [], roads: [], paths: [], not_paths: [], box: { x, y, w, h } }) + ways.push([]) } function defdepleted(name) { @@ -366,27 +390,45 @@ function defvassal(name) { vassalbox.push({ name, box: { x, y, w, h } }) } -function defway(type, list) { - let ix = ways.length - list = list.map(name=>locmap[name]).sort(cmpnum) - ways.push({type, locales: list}) - for (let from of list) { - for (let to of list) { - if (from !== to) { - let old = locales[from].ways.find(w => w[0] === to) - if (old) - old.push(ix) - else - locales[from].ways.push([to, ix]) - } - } + +function defway(type, aname, bname) { + let aix = locmap[aname] + let bix = locmap[bname] + if (aix > bix) { + let tmp = aix + aix = bix + bix = tmp + } + + let a = locales[aix] + let b = locales[bix] + + map_set(ways[aix], bix, type) + map_set(ways[bix], aix, type) + + locales[aix].adjacent.push(bix) + locales[bix].adjacent.push(aix) + + if (type === "highway") { + locales[aix].highways.push(bix) + locales[bix].highways.push(aix) + } + if (type === "road") { + locales[aix].roads.push(bix) + locales[bix].roads.push(aix) + } + if (type === "path") { + locales[aix].paths.push(bix) + locales[bix].paths.push(aix) + } else { + locales[aix].not_paths.push(bix) + locales[bix].not_paths.push(aix) } - return ways[ix] } -function highway(locs) { return defway('highway', locs.split(", ")) } -function road(locs) { return defway('road', locs.split(", ")) } -function path(locs) { return defway('path', locs.split(", ")) } +function highway(a,b) { return defway('highway', a, b) } +function road(a,b) { return defway('road', a, b) } +function path(a,b) { return defway('path', a, b) } // LOCALES @@ -631,90 +673,90 @@ defvassal("vassal vassal_beaumont") //WAYS BETWEEN LOCALES -highway("Bamburgh, Newcastle") -highway("Newcastle, York") -highway("York, Lincoln") -highway("Lincoln, Peterborough") -highway("Peterborough, Ely") -highway("Nottingham, Leicester") -highway("Leicester, Northampton") -highway("Bedford, St Albans") -highway("St Albans, Cambridge") -highway("St Albans, London") -highway("London, Oxford") -highway("Oxford, Gloucester") -highway("Gloucester, Hereford") -highway("Gloucester, Worcester") -highway("Hereford, Ludlow") -highway("Gloucester, Bristol") -highway("London, Guildford") -highway("Guildford, Winchester") -highway("Exeter, Wells") -highway("Winchester, Salisbury") -highway("Salisbury, Wells") -highway("Cambridge, Ely") -highway("Northampton, Bedford") - - -road("Gloucester, Cardiff") -road("Newbury, Oxford") -road("Rochester, Hastings") -road("Hexham, Carlisle") -road("Hexham, Newcastle") -road("Appleby, Carlisle") -road("Appleby, Newcastle") -road("Lincoln, Nottingham") -road("Nottingham, Derby") -road("Chester, Shrewsbury") -road("Shrewsbury, Lichfield") -road("Lichfield, Leicester") -road("Lichfield, Coventry") -road("Leicester, Peterborough") -road("Ely, Lynn") -road("Ely, Bury St Edmunds") -road("Bury St Edmunds, Norwich") -road("Norwich, Lynn") -road("Norwich, Ipswich") -road("Ipswich, Bury St Edmunds") -road("Ipswich, St Albans") -road("Bury St Edmunds, Cambridge") -road("Cambridge, Bedford") -road("Peterborough, Northampton") -road("Northampton, Coventry") -road("Northampton, Oxford") -road("Lichfield, Worcester") -road("Shrewsbury, Ludlow") -road("Ludlow, Worcester") -road("London, Rochester") -road("Rochester, Canterbury") -road("Canterbury, Dover") -road("Dover, Hastings") -road("Hastings, Arundel") -road("Arundel, Southampton") -road("Southampton, Winchester") -road("Southampton, Salisbury") -road("Salisbury, Newbury") -road("Salisbury, Dorchester") -road("Dorchester, Wells") -road("Dorchester, Exeter") -road("Wells, Bristol") -road("Exeter, Launceston") -road("Plymouth, Launceston") -road("Exeter, Plymouth") -road("Plymouth, Truro") -road("Truro, Launceston") -road("Derby, Lichfield") -path("Appleby, Lancaster") -path("Lancaster, Chester") -path("Chester, York") -path("Chester, Harlech") -path("Harlech, Pembroke") -path("Pembroke, Cardiff") - -road("Newcastle, Scarborough") -road("Scarborough, York") -road("York, Ravenspur") -road("Ravenspur, Lincoln") +highway("Bamburgh", "Newcastle") +highway("Newcastle", "York") +highway("York", "Lincoln") +highway("Lincoln", "Peterborough") +highway("Peterborough", "Ely") +highway("Nottingham", "Leicester") +highway("Leicester", "Northampton") +highway("Bedford", "St Albans") +highway("St Albans", "Cambridge") +highway("St Albans", "London") +highway("London", "Oxford") +highway("Oxford", "Gloucester") +highway("Gloucester", "Hereford") +highway("Gloucester", "Worcester") +highway("Hereford", "Ludlow") +highway("Gloucester", "Bristol") +highway("London", "Guildford") +highway("Guildford", "Winchester") +highway("Exeter", "Wells") +highway("Winchester", "Salisbury") +highway("Salisbury", "Wells") +highway("Cambridge", "Ely") +highway("Northampton", "Bedford") + + +road("Gloucester", "Cardiff") +road("Newbury", "Oxford") +road("Rochester", "Hastings") +road("Hexham", "Carlisle") +road("Hexham", "Newcastle") +road("Appleby", "Carlisle") +road("Appleby", "Newcastle") +road("Lincoln", "Nottingham") +road("Nottingham", "Derby") +road("Chester", "Shrewsbury") +road("Shrewsbury", "Lichfield") +road("Lichfield", "Leicester") +road("Lichfield", "Coventry") +road("Leicester", "Peterborough") +road("Ely", "Lynn") +road("Ely", "Bury St Edmunds") +road("Bury St Edmunds", "Norwich") +road("Norwich", "Lynn") +road("Norwich", "Ipswich") +road("Ipswich", "Bury St Edmunds") +road("Ipswich", "St Albans") +road("Bury St Edmunds", "Cambridge") +road("Cambridge", "Bedford") +road("Peterborough", "Northampton") +road("Northampton", "Coventry") +road("Northampton", "Oxford") +road("Lichfield", "Worcester") +road("Shrewsbury", "Ludlow") +road("Ludlow", "Worcester") +road("London", "Rochester") +road("Rochester", "Canterbury") +road("Canterbury", "Dover") +road("Dover", "Hastings") +road("Hastings", "Arundel") +road("Arundel", "Southampton") +road("Southampton", "Winchester") +road("Southampton", "Salisbury") +road("Salisbury", "Newbury") +road("Salisbury", "Dorchester") +road("Dorchester", "Wells") +road("Dorchester", "Exeter") +road("Wells", "Bristol") +road("Exeter", "Launceston") +road("Plymouth", "Launceston") +road("Exeter", "Plymouth") +road("Plymouth", "Truro") +road("Truro", "Launceston") +road("Derby", "Lichfield") +path("Appleby", "Lancaster") +path("Lancaster", "Chester") +path("Chester", "York") +path("Chester", "Harlech") +path("Harlech", "Pembroke") +path("Pembroke", "Cardiff") + +road("Newcastle", "Scarborough") +road("Scarborough", "York") +road("York", "Ravenspur") +road("Ravenspur", "Lincoln") let way_sea_1 = ["North Sea", "English Channel", "Bamburgh", "Newcastle", "Scarborough", "Ravenspur", "Lynn", "Ipswich", "Dover", "Hastings", "Calais", "Arundel", "Southampton", "Dorchester", "Exeter", "Plymouth", "Truro"].map(name => locmap[name]).sort(cmpnum) let way_sea_2 = ["English Channel","North Sea", "Irish Sea", "Bristol","Pembroke","Harlech", "English Channel","Bamburgh", "Newcastle", "Scarborough", "Ravenspur", "Lynn", "Ipswich","Dover", "Hastings", "Calais", "Arundel", "Southampton", "Dorchester", "Exeter", "Plymouth", "Truro" ].map(name => locmap[name]).sort(cmpnum) @@ -755,46 +797,11 @@ function dumplist(name, list) { } locales.forEach(loc => { - loc.adjacent = [] - loc.adjacent_by_highway = [] - loc.adjacent_by_road = [] - loc.adjacent_by_path = [] - loc.highways = [] - loc.roads = [] - loc.paths = [] - for (let data of loc.ways) { - let to = data[0] - for (let i = 1; i < data.length; ++i) { - let way = data[i] - if (!loc.adjacent.includes(to)) - loc.adjacent.push(to) - if (ways[way].type === "highway") { - if (!loc.adjacent_by_highway.includes(to)) { - loc.adjacent_by_highway.push(to) - loc.highways.push([to,way]) - } - } - if (ways[way].type === "road") { - if (!loc.adjacent_by_road.includes(to)) { - loc.adjacent_by_road.push(to) - loc.roads.push([to,way]) - } - } - if (ways[way].type === "path") { - if (!loc.adjacent_by_path.includes(to)) { - loc.adjacent_by_path.push(to) - loc.paths.push([to,way]) - } - } - } - } loc.adjacent.sort(cmpnum) - loc.adjacent_by_highway.sort(cmpnum) - loc.adjacent_by_road.sort(cmpnum) - loc.adjacent_by_path.sort(cmpnum) - loc.highways.sort(cmpnum2) - loc.roads.sort(cmpnum2) - loc.paths.sort(cmpnum2) + loc.highways.sort(cmpnum) + loc.roads.sort(cmpnum) + loc.paths.sort(cmpnum) + loc.not_paths.sort(cmpnum) }) function seats(list) { |