Island Wi-Fi: no new routing fields until you run a zone

emptyR() carried cityWisp, wisp and wispL in every game, so a game with no island zones no longer routed to the same R
as main and tests/route-fuzz.test.js failed on its first move. compute() now adds them only while a zone runs (as
satU), wispMoney() returns without them, and the agent's results docs say so. tests/wisp-zones.test.js checks that a
game without zones, and one below level 2, has none of them. The mp-sim fixtures were written again with
tests/lib/mp-sim-fixtures.js (only the three empty fields left them; a second run changes nothing).
This commit is contained in:
jvanvik 2026-11-12 02:40:09 +01:00
parent 66ac7d0af1
commit 5ca8270db9
8 changed files with 14 additions and 12 deletions

View file

@ -99,8 +99,9 @@ function compute(){RW.gen++;
const bizBw={};for(const b of S.biz){const T=BIZ_T[b.type];if(!T.l2&&!T.fiber&&(!T.event||eventLive(b))){if(T.orbit){const g=PX&&PX.gs[b.id];if(g)bizBw[g]=(bizBw[g]||0)+PX.term[b.id];continue;}const v=bizBw[b.city];bizBw[b.city]=(v===undefined?0:v)+b.bw;}}
// Traffic shares by network index, and their sums, for each share table (and with Russia's throttle).
const shArr=new Map(),shSum=new Map(),DEMTO=new Float64Array(NN),loc=scnRule('local');
// Island Wi-Fi (46-wisp-zones.js): a zone's homes are its city's demand, as far as its backhaul reaches them.
const WZI=wispOn()?wispIn(viral):null;R2.wispL=WZI?WZI.L:[];
// Island Wi-Fi (46-wisp-zones.js): a zone's homes are its city's demand, as far as its backhaul reaches them. Its
// fields are only in R while you run a zone, so every other game routes to the same R as before.
const WZI=wispOn()?wispIn(viral):null;if(WZI){R2.wispL=WZI.L;R2.cityWisp={};R2.wisp={};}
(()=>{for(const c of Object.keys(S.pops)){
const p=S.pops[c],ci=CIDX[c],cn=cnCity(c),SH=cn?NSH_CN:ruCity(c)?NSH_RU:CITY[c].kr&&S.krExit?NSH_KRX:NSH;const eye=(p.bb?p.bb.d:0)*viral*(cn&&ev.golden>day?1.4:1);const biz=bizBw[c]??0;
const wz=WZI?WZI.by[c]||0:0;if(wz)R2.cityWisp[c]=wz;const d0=eye+wz+biz;