Subsea cables stay at sea: fix the date-line wrap and routes across land (#183)
Eight Pacific pairs added in 1.35.0 had waypoints that jumped from +180 to -180 longitude, so the renderer drew them across the whole map. Waypoint longitudes are now continuous, as the hand-drawn routes always were. A scan of all 475 cable pairs found 147 that cut across land with sea on both sides (the Horn of Africa, Arabia, India, Brazil, Newfoundland, ...). Those now follow the game's own sea router, simplified only as far as the line stays off land; inland endpoints route between the coastal ends and keep their overland leg. 27 more pairs into inland cities now come ashore at the nearest coast. Hibernia Express is traced by hand south of Ireland to Brean so it stays the straightest Atlantic crossing. Left alone on purpose: the Suez Canal and Dardanelles crossings, Quintillion's overland Alaska leg and Celtix's Welsh landing. Tests: no pair jumps the seam and none crosses more than 160 km of land mid-route. EIG is now 8,613 km, so overland is 9.97x subsea instead of 10x+; Lisbon-Lagos fits 1.6T directly at 5,914 km. Thanks to mindolo for the report and the analysis in #183.
This commit is contained in:
parent
daa1ad0b05
commit
29ad74743c
5 changed files with 114 additions and 99 deletions
|
|
@ -7,6 +7,7 @@ All notable changes to this project are documented here. The project follows
|
|||
## [Unreleased]
|
||||
|
||||
- Found a bug or have an idea? The menu and How to play now link straight to the forms on GitHub, where every report is tracked. The Signal group stays for chatting.
|
||||
- Subsea cables stay at sea: Pacific cables no longer draw a line across the whole world where the map wraps round (#183), and over 170 cable routes that cut across Africa, Arabia, India, Brazil and other coasts now follow the sea. Cables into inland cities like Paris, Dublin and Hong Kong come ashore at the nearest coast.
|
||||
|
||||
## [1.35.0] — 2026-10-27
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -331,7 +331,8 @@ test('#40 overland between continents costs ten times subsea or more, and has no
|
|||
const sub=waveMo(c.km,true,2)*CAB[c.cid].price*waveMarket(c.a,c.b,true).m;return [land/sub,!!(CITY[c.a].land2||CITY[c.b].land2)];}))`));
|
||||
assert.ok(r.length >= 4, 'Europe–Asia cable routes exist to compare');
|
||||
// Across a land bridge (Cairo, #47) the cable goes the long way round Arabia, so overland is "only" 4–9× dearer.
|
||||
for (const [x, bridge] of r) assert.ok(x >= (bridge ? 4 : 10), `overland is at least ${bridge ? 4 : 10}× subsea (${x.toFixed(1)})`);
|
||||
// EIG from Dubai now follows Arabia and the Suez Canal at sea, which makes it a little longer: 9.97× (#183).
|
||||
for (const [x, bridge] of r) assert.ok(x >= (bridge ? 4 : 9.5), `overland is at least ${bridge ? 4 : 9.5}× subsea (${x.toFixed(1)})`);
|
||||
assert.equal(ev("landX('mrs','hkg')"), true);
|
||||
assert.equal(ev("landX('fra','mrs')"), false, 'inside Europe stays normal');
|
||||
assert.equal(ev("landMult('fra','mrs')"), 1);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,18 @@ test('the Indian Ocean and Asia-Pacific: the big real cables, Muscat, the Maldiv
|
|||
}
|
||||
// every cable pair has a drawn route and a sane length
|
||||
assert.equal(ev("CABLE_PAIRS.filter(p=>!(p.km>0&&p.km<25000)||p.pts.some(q=>!isFinite(q[0])||!isFinite(q[1]))).length"), 0);
|
||||
// no route jumps across the whole map at the ±180° seam: waypoints keep continuous longitudes (#183)
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(CABLE_PAIRS.filter(p=>p.pts.some((q,i)=>i&&Math.abs(q[0]-p.pts[i-1][0])>W/3)).map(p=>p.cid+':'+p.a+'-'+p.b))")), []);
|
||||
assert.ok(ev("cablePair('fast','sea','osa').km") < 9500, 'FASTEST to Osaka crosses the Pacific, not the world');
|
||||
// subsea cables stay at sea: a stretch over land with sea on both sides is the line cutting across a coast.
|
||||
// Allowed: the Suez Canal and the Dardanelles (not water in the coastline), and Quintillion's overland Alaska leg.
|
||||
const cross = JSON.parse(ev(`JSON.stringify((()=>{const big=COAST.filter(p=>ringArea(p)>=40).map(p=>{let a=1e9,b=-1e9,c=1e9,d=-1e9;for(const [x,y] of p){a=Math.min(a,x);b=Math.max(b,x);c=Math.min(c,y);d=Math.max(d,y);}return {p,a,b,c,d};});
|
||||
const on=(x,y)=>{x=((x%W)+W)%W;return big.some(q=>x>=q.a&&x<=q.b&&y>=q.c&&y<=q.d&&inPoly(x,y,q.p));};const out=[];
|
||||
for(const p of CABLE_PAIRS){if(p.cid==='qtl'&&[p.a,p.b].sort().join()==='anc,brw')continue;const s=[];
|
||||
for(let i=1;i<p.pts.length;i++){const [x0,y0]=p.pts[i-1],[x1,y1]=p.pts[i];const n=Math.max(1,Math.ceil(Math.hypot(x1-x0,y1-y0)/1.5));for(let k=(i===1?0:1);k<=n;k++)s.push([x0+(x1-x0)*k/n,y0+(y1-y0)*k/n]);}
|
||||
const L=s.map(q=>on(q[0],q[1]));let i=0;while(i<L.length){if(!L[i]){i++;continue;}let j=i;while(j+1<L.length&&L[j+1])j++;const km=(j-i+1)*p.km/s.length;if(i>0&&j<L.length-1&&km>160)out.push(p.cid+':'+p.a+'-'+p.b+' '+Math.round(km)+' km');i=j+1;}}
|
||||
return out;})())`));
|
||||
assert.deepEqual(cross, [], 'cables cutting across land');
|
||||
// a hop on one of the new cables carries traffic
|
||||
ev("for(const c of ['sin','hkg']){ACT.buildPop({city:c});S.pops[c].rgen=3;}UI.via='sjc2';UI.route='same';openLinkModal('sin','hkg');ACT.buildLink({tier:2});closeModal();compute()");
|
||||
assert.ok(ev("S.links.some(l=>l.cable==='sjc2')"), 'a wave on SJC2');
|
||||
|
|
|
|||
|
|
@ -786,8 +786,9 @@ test('Atlantic islands and Halifax: real landings, real exchanges only, and isla
|
|||
assert.equal(hop(['mia', 'pdl', 'lis']), 1600, 'Florida to Lisbon via the Azores');
|
||||
assert.equal(direct('atn', 'lis'), 1200);
|
||||
assert.equal(hop(['atn', 'bda', 'lis']), 1600);
|
||||
assert.equal(direct('lis', 'lag'), 1200);
|
||||
// Equi-yes follows the coast close enough to fit 1.6T on its own; the Canaries hop matches it
|
||||
assert.equal(hop(['lis', 'tci', 'lag']), 1600, 'Lisbon to Lagos via the Canaries');
|
||||
assert.ok(hop(['lis', 'tci', 'lag']) >= direct('lis', 'lag'));
|
||||
assert.equal(direct('for', 'mad'), 1200);
|
||||
assert.equal(hop(['for', 'rai', 'lis']), 1600, 'Brazil to Europe via Cape Verde');
|
||||
assert.equal(hop(['nyc', 'hfx']), 3200);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue