Clicks that change nothing routing reads keep their routing (loans do reroute); CHANGELOG corrected

This commit is contained in:
Frederic Jung 2026-11-01 18:36:52 +01:00
parent de9b56befe
commit 935c08839f
No known key found for this signature in database
3 changed files with 57 additions and 2 deletions

View file

@ -24,7 +24,13 @@ function chWhy(l,o){const O=OPT[o];if(!techOk('opt',o,O.lvl))return tr('action_h
if((l.ch||[]).length+soldSlots(l)>=chMax(l))return soldSlots(l)?tr('action_helpers.sys_is_full_max_channels_sold',{sys:DF_SYS[l.sys].n,max:chMax(l),sold:soldSlots(l)}):tr('action_helpers.sys_is_full_max_channels',{sys:DF_SYS[l.sys].n,max:chMax(l)});
for(const c of [l.a,l.b]){const p=S.pops[c];if(p&&RG[p.rgen||0].cls<O.rg)return tr('action_helpers.needs_routers_with_pn_ports_or',{pn:RG[mainRG(O.rg)].pn,city:CITY[c].name});}return '';}
function bbCost(c){return 15000+CITY[c].P*20;}
function after(){if(pzOn()){pzAfter();return;}if(S)purgeInc();compute();checkGoals();renderAll();if(S&&!$('dash').hidden)renderDash();save();}
/* A click that changes nothing routing reads (the log, offers, cash, names, settings…) keeps the routing it has:
compute() gives the same R again for the same state (tests/compute-idempotent), so it is skipped. The key is the save
without the fields routing never reads (tests/route-skip checks each one); any other change routes again. */
const RK_SKIP=new Set(['name','log','offers','usedNames','stats','cash','seen','tut','ach','achP','won','loanOffers','loanStrikes','uiSpeed','cam','richTold','demo','nextEvent','nextFail','done','confReg','auNews','solWon','seatOff','chartSet','t1Now','ltv','capDeal','auV','pdeskRep','sv']);
function routeKey(){const o={};for(const k in S)if(!RK_SKIP.has(k))o[k]=S[k];return JSON.stringify(o);}
function routeIfChanged(){const k=S&&!pzOn()?routeKey():null;if(k&&k===UI.rk&&R===UI.rkR)return false;compute();UI.rk=k;UI.rkR=R;return true;}
function after(){if(pzOn()){pzAfter();return;}if(S)purgeInc();routeIfChanged();checkGoals();renderAll();if(S&&!$('dash').hidden)renderDash();save();}
const isTablet=()=>innerWidth>760&&innerWidth<=1200;
function selectLink(id){UI.sel={type:'link',id};UI.confirm=null;if(isTablet()||isPhone())UI.leftOpen=false;$('panel').classList.remove('full');renderPanel();renderLeft();}
// Frame the whole drawn line (cables bend far from the straight one) in the part of the map the panel leaves free: