From 71e7dcec59a2e70382411151eddea297117f66c7 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sun, 8 Nov 2026 17:57:32 +0000 Subject: [PATCH] Say how to reach a coast where no subsea cable lands yet (#321) Iqaluit, Adamstown, Murmansk and the Russian Arctic towns have a beach but no cable, so the link modal listed nobody to hop through ("Cables from Iqaluit reach . Hop through one of those."), and from the other side it suggested hops that could never get there. Now it says to go overland when a road leads in, or that only your own cable reaches it, with the own-cable button (or its level hint) underneath. --- CHANGELOG.md | 1 + site/i18n/de.js | 2 ++ site/i18n/es.js | 2 ++ site/i18n/fr.js | 2 ++ site/i18n/it.js | 2 ++ site/i18n/pt.js | 2 ++ src/game/95-modals/70-link-modal.js | 5 +++- src/i18n/en.js | 2 ++ tests/link-modal-no-cable.test.js | 39 +++++++++++++++++++++++++++++ 9 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 tests/link-modal-no-cable.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index d0fb62a..86dbb45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Linking to a coast where no subsea cable lands yet, like Iqaluit, now says how you can get there (overland, or with a cable of your own) instead of listing no cities to hop through (#321). - While nothing moves on the map but its animations (packets, waves, clouds), it is drawn 30 times a second instead of at the screen's full rate, half the work on most screens and a quarter on 120 Hz phones. Moving the map, pointing at something or anything changing on the network still gets every frame, and the animations keep their speed. - A paused game no longer rewrites its save every 5 seconds when nothing has changed. On a big network each of those writes held the page for 20 to 30 milliseconds. - At ×8 a big network's autosave no longer holds the page: the game is packed, turned into text and compressed in the background, and less of each day's routing has to travel back to the page. The game plays exactly as before. diff --git a/site/i18n/de.js b/site/i18n/de.js index d780960..a6a5f86 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2745,6 +2745,8 @@ "link_modal.no_circuit_crosses_between_north_and":"Zwischen Nord- und Südkorea gibt es keine Leitung, und kein Carrier verkauft dir eine. Pjöngjang erreicht die Welt über China und Russland.", "link_modal.no_subsea_cable_lands_in_both":"Kein Seekabel landet sowohl in {a} als auch in {b} an. Kabel aus {a} erreichen {list}. Nimm den Weg über eine dieser Städte.", "link_modal.no_subsea_cable_lands_in_city":"In {city} landet kein Seekabel an. Die nächste Landestation ist {near}: Verleg zuerst Glasfaser dorthin und nimm dann von dort ein Kabel.", +"link_modal.no_subsea_cable_lands_in_city_land":"In {city} landet noch kein Seekabel an. Komm über Land hin oder verleg dein eigenes Seekabel.", +"link_modal.no_subsea_cable_lands_in_city_own":"In {city} landet noch kein Seekabel an, und keine Straße und keine Glasfaser führen über Land dorthin. Nur ein eigenes Seekabel kommt da hin.", "link_modal.nobody_sells_capacity_between_kyiv":"Niemand verkauft Kapazität zwischen Kyjiw und Moskau, und niemand wird es tun. Route stattdessen über Warschau, Bukarest oder Helsinki.", "link_modal.not_without_a_license":"Nicht ohne Lizenz", "link_modal.premium_crossing_60_3_loss":"Premium-Übergang +60 % · ~3 % Verlust", diff --git a/site/i18n/es.js b/site/i18n/es.js index 44de436..6c8f123 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2743,6 +2743,8 @@ "link_modal.no_circuit_crosses_between_north_and":"Ningún circuito cruza entre Corea del Norte y Corea del Sur, y ningún operador te venderá uno. Pyongyang llega al mundo a través de China y Rusia.", "link_modal.no_subsea_cable_lands_in_both":"Ningún cable submarino aterriza en {a} y {b} a la vez. Los cables de {a} llegan a {list}. Salta por uno de esos.", "link_modal.no_subsea_cable_lands_in_city":"Ningún cable submarino aterriza en {city}. La estación de aterrizaje más cercana es {near}: tiende fibra hasta allí primero y luego toma un cable desde ella.", +"link_modal.no_subsea_cable_lands_in_city_land":"Ningún cable submarino aterriza todavía en {city}. Llega por tierra o tiende tu propio cable submarino.", +"link_modal.no_subsea_cable_lands_in_city_own":"Ningún cable submarino aterriza todavía en {city}, y ninguna carretera ni fibra llega por tierra. Solo un cable submarino propio puede llegar allí.", "link_modal.nobody_sells_capacity_between_kyiv":"Nadie vende capacidad entre Kiev y Moscú, y nadie va a hacerlo. Rodea por Varsovia, Bucarest o Helsinki.", "link_modal.not_without_a_license":"No sin licencia", "link_modal.premium_crossing_60_3_loss":"Cruce premium +60 % · ~3 % de pérdida", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 069032e..4598446 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2743,6 +2743,8 @@ "link_modal.no_circuit_crosses_between_north_and":"Aucun circuit ne passe entre la Corée du Nord et la Corée du Sud, et aucun opérateur ne t'en vendra un. Pyongyang rejoint le monde par la Chine et la Russie.", "link_modal.no_subsea_cable_lands_in_both":"Aucun câble sous-marin n’atterrit à la fois à {a} et à {b}. Les câbles partant de {a} vont vers {list}. Fais escale dans l’une de ces villes.", "link_modal.no_subsea_cable_lands_in_city":"Aucun câble sous-marin n’atterrit à {city}. La station d’atterrissement la plus proche est {near} : amène d’abord la fibre jusque-là, puis prends un câble depuis là-bas.", +"link_modal.no_subsea_cable_lands_in_city_land":"Aucun câble sous-marin n’atterrit encore à {city}. Arrive par voie terrestre, ou pose ton propre câble sous-marin.", +"link_modal.no_subsea_cable_lands_in_city_own":"Aucun câble sous-marin n’atterrit encore à {city}, et aucune route ni fibre n’y mène par voie terrestre. Seul ton propre câble sous-marin peut y arriver.", "link_modal.nobody_sells_capacity_between_kyiv":"Personne ne vend de capacité entre Kyiv et Moscow, et personne ne le fera. Passe plutôt par Warsaw, Bucharest ou Helsinki.", "link_modal.not_without_a_license":"Pas sans licence", "link_modal.premium_crossing_60_3_loss":"Passage premium +60 % · ~3 % de perte", diff --git a/site/i18n/it.js b/site/i18n/it.js index 3469d49..edb8ab5 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2743,6 +2743,8 @@ "link_modal.no_circuit_crosses_between_north_and":"Nessun circuito attraversa il confine tra Corea del Nord e Corea del Sud, e nessun operatore te ne venderà uno. Pyongyang raggiunge il mondo attraverso Cina e Russia.", "link_modal.no_subsea_cable_lands_in_both":"Nessun cavo sottomarino approda sia a {a} che a {b}. I cavi da {a} raggiungono: {list}. Fai tappa in una di queste.", "link_modal.no_subsea_cable_lands_in_city":"Nessun cavo sottomarino approda a {city}. La stazione di approdo più vicina è {near}: porta prima la fibra fin lì, poi prendi un cavo da lì.", +"link_modal.no_subsea_cable_lands_in_city_land":"Nessun cavo sottomarino approda ancora a {city}. Arrivaci via terra, oppure posa un cavo sottomarino tutto tuo.", +"link_modal.no_subsea_cable_lands_in_city_own":"Nessun cavo sottomarino approda ancora a {city}, e nessuna strada o fibra ci arriva via terra. Solo un cavo sottomarino tutto tuo può arrivarci.", "link_modal.nobody_sells_capacity_between_kyiv":"Nessuno vende capacità tra Kyiv e Moscow, e nessuno lo farà mai. Passa invece da Warsaw, Bucharest o Helsinki.", "link_modal.not_without_a_license":"Non senza una licenza", "link_modal.premium_crossing_60_3_loss":"Attraversamento premium +60% · ~3% di perdita", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 2b86373..08f4586 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2743,6 +2743,8 @@ "link_modal.no_circuit_crosses_between_north_and":"Nenhum circuito cruza entre a Coreia do Norte e a Coreia do Sul, e nenhuma operadora vai te vender um. Pyongyang chega ao mundo pela China e pela Rússia.", "link_modal.no_subsea_cable_lands_in_both":"Nenhum cabo submarino desembarca em {a} e {b} ao mesmo tempo. Os cabos de {a} chegam a {list}. Faça um hop por um deles.", "link_modal.no_subsea_cable_lands_in_city":"Nenhum cabo submarino chega a {city}. A estação de chegada mais próxima é {near}: leve fibra até lá primeiro e depois pegue um cabo de lá.", +"link_modal.no_subsea_cable_lands_in_city_land":"Nenhum cabo submarino chega a {city} ainda. Chegue lá por terra ou lance seu próprio cabo submarino.", +"link_modal.no_subsea_cable_lands_in_city_own":"Nenhum cabo submarino chega a {city} ainda, e nenhuma estrada ou fibra chega lá por terra. Só um cabo submarino seu pode chegar lá.", "link_modal.nobody_sells_capacity_between_kyiv":"Ninguém vende capacidade entre Kyiv e Moscou, e ninguém vai vender. Passe por Varsóvia, Bucareste ou Helsinque.", "link_modal.not_without_a_license":"Não sem licença", "link_modal.premium_crossing_60_3_loss":"Travessia premium +60% · ~3% de perda", diff --git a/src/game/95-modals/70-link-modal.js b/src/game/95-modals/70-link-modal.js index a7b5c25..5041ab6 100644 --- a/src/game/95-modals/70-link-modal.js +++ b/src/game/95-modals/70-link-modal.js @@ -9,7 +9,10 @@ function openLinkModal(a,b){ const mode=UI.lmode==='df'?'df':'wave',tabs=`
${btn(tr('link_modal.lease_a_wave'),'dfMode',{m:'wave'},mode==='wave'?'pink':'ghost')}${btn(tr('common.dark_fiber'),'dfMode',{m:'df'},mode==='df'?'pink':'ghost')}
`; const head=`
${sub?tr('common.subsea_a6be'):tr('common.terrestrial_19e4')} · ${km.toLocaleString()} km

${CITY[a].name} → ${CITY[b].name}

${tabs}`; if(mode==='df'){openModal(head+dfModalBody(a,b,km,pop));return;} - if(sub&&!cablesOk(a,b).length){const fr=[...new Set(CABLE_PAIRS.filter(c=>c.a===a||c.b===a).map(c=>CITY[c.a===a?c.b:c.a].name))],dry=[a,b].find(c=>!landing(c));openModal(head+`

${dry?tr('link_modal.no_subsea_cable_lands_in_city',{city:CITY[dry].name,near:CITY[nearLanding(dry)].name}):tr('link_modal.no_subsea_cable_lands_in_both',{a:CITY[a].name,b:CITY[b].name,list:fr.join(', ')})}

${cabOpen()&&!ownCabWhy(a,b)?ownCabTeaser(a,b):''}`);return;} + if(sub&&!cablesOk(a,b).length){const fr=[...new Set(CABLE_PAIRS.filter(c=>c.a===a||c.b===a).map(c=>CITY[c.a===a?c.b:c.a].name))],dry=[a,b].find(c=>!landing(c)); + // a beach with no cable yet (#321): hopping cannot help, only a road in or a cable of your own + const bare=!dry&&[a,b].find(c=>!CABLE_PAIRS.some(p=>p.a===c||p.b===c)),road=bare&&CITIES.some(x=>x.id!==bare&&!isSub(bare,x.id)); + openModal(head+`

${dry?tr('link_modal.no_subsea_cable_lands_in_city',{city:CITY[dry].name,near:CITY[nearLanding(dry)].name}):bare?(road?tr('link_modal.no_subsea_cable_lands_in_city_land',{city:CITY[bare].name}):tr('link_modal.no_subsea_cable_lands_in_city_own',{city:CITY[bare].name})):tr('link_modal.no_subsea_cable_lands_in_both',{a:CITY[a].name,b:CITY[b].name,list:fr.join(', ')})}

${(cabOpen()?!ownCabWhy(a,b):bare)?ownCabTeaser(a,b):''}`);return;} if(isSub(a,b)&&S.ev.landban&&S.ev.landban.until>S.day&&[a,b].includes(S.ev.landban.city)){openModal(head+`

${tr('link_modal.the_landing_permit_dispute_in_city',{city:CITY[S.ev.landban.city].name,n:S.ev.landban.until-S.day})}

`);return;} if(uaePair(a,b)||andesPair(a,b)||rainPair(a,b)||borderPair(a,b))route+=`

${landWhy(a,b)}

`; route+=`

📈 ${esc(marketNote(a,b,sub))}

`; diff --git a/src/i18n/en.js b/src/i18n/en.js index 11a050a..5323950 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2744,6 +2744,8 @@ "link_modal.no_circuit_crosses_between_north_and":"No circuit crosses between North and South Korea, and no carrier will sell you one. Pyongyang reaches the world through China and Russia.", "link_modal.no_subsea_cable_lands_in_both":"No subsea cable lands in both {a} and {b}. Cables from {a} reach {list}. Hop through one of those.", "link_modal.no_subsea_cable_lands_in_city":"No subsea cable lands in {city}. The nearest landing station is {near}: run fiber there first, then take a cable from it.", +"link_modal.no_subsea_cable_lands_in_city_land":"No subsea cable lands in {city} yet. Reach it overland, or lay a subsea cable of your own.", +"link_modal.no_subsea_cable_lands_in_city_own":"No subsea cable lands in {city} yet, and no road or fiber reaches it overland. Only a subsea cable of your own can get there.", "link_modal.nobody_sells_capacity_between_kyiv":"Nobody sells capacity between Kyiv and Moscow, and nobody is going to. Route through Warsaw, Bucharest or Helsinki instead.", "link_modal.not_without_a_license":"Not without a license", "link_modal.premium_crossing_60_3_loss":"Premium crossing +60% · ~3% loss", diff --git a/tests/link-modal-no-cable.test.js b/tests/link-modal-no-cable.test.js new file mode 100644 index 0000000..74f8feb --- /dev/null +++ b/tests/link-modal-no-cable.test.js @@ -0,0 +1,39 @@ +// #321: a subsea link to or from a coast where no cable lands yet (Iqaluit, Adamstown, Murmansk) said +// "Cables from Iqaluit reach . Hop through one of those." It now says what can actually reach that city. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const card = (ev, a, b) => ev(`UI.lmode='wave';openLinkModal('${a}','${b}');const t=$('modalCard').textContent;closeModal();t`); + +test('#321 no cable lands in Iqaluit: no empty list, the only way in is your own cable', () => { + const { ev, errors } = load(); + ev("ACT.start({});S.cash=1e9;S.lvl=1;for(const g of GOALS)S.done[g.id]=0"); + assert.ok(!ev("cabOpen()")); + for (const [a, b] of [['yfb', 'nuk'], ['nuk', 'yfb'], ['nyc', 'pcn']]) { + const t = card(ev, a, b), city = ev(`CITY['${b === 'nuk' ? a : b}'].name`); + assert.doesNotMatch(t, /reach \.|Hop through/, `${a}→${b}: ${t}`); + assert.ok(t.includes(ev(`tr('link_modal.no_subsea_cable_lands_in_city_own',{city:'${city}'})`)), `${a}→${b}: ${t}`); + assert.match(t, /level 9 or Tier 1/, `${a}→${b} points at the level that unlocks your own cable`); + } + // once you can lay one, the button to do it is right there + ev("S.lvl=9"); + assert.ok(ev("cabOpen()")); + assert.match(card(ev, 'yfb', 'nuk'), /Lay your own subsea cable|Surveying/); + assert.deepEqual(errors, []); +}); + +test('#321 a coast with no cable but a road in: reach it overland, never "hop through" cables that miss it', () => { + const { ev, errors } = load(); + ev("ACT.start({});S.cash=1e9;S.lvl=1;for(const g of GOALS)S.done[g.id]=0"); + for (const [a, b, c] of [['nyc', 'mmk', 'mmk'], ['dks', 'nyc', 'dks']]) { + const t = card(ev, a, b); + assert.doesNotMatch(t, /Hop through/, `${a}→${b}: ${t}`); + assert.ok(t.includes(ev(`tr('link_modal.no_subsea_cable_lands_in_city_land',{city:CITY.${c}.name})`)), `${a}→${b}: ${t}`); + } + // two cities that both have cables, just not a shared one, still get the cities to hop through + const t = card(ev, 'nuk', 'syd'); + assert.match(t, /Hop through one of those/); + assert.doesNotMatch(t, /reach \./); + assert.deepEqual(errors, []); +});