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:
Frederic Jung 2026-10-28 06:17:28 +01:00
parent daa1ad0b05
commit 29ad74743c
No known key found for this signature in database
5 changed files with 114 additions and 99 deletions

View file

@ -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);