Steps resumed after the worker routes read the game as it is: a sales trial, the intern's PNI round and a failure's incident

While a step of the day waits for the route worker, the player can act. Three steps then resumed on what they had
noted before:
- a sales trial overtaken by an action ran again with the happy customers as indices into S.biz: a customer dropped
  meanwhile made one point past the end and the day stopped on an exception. dayAgain() makes the trial's checks,
  the customer and who is happy again on the game as it is; an offer signed or declined by hand meanwhile is not
  the desk's;
- the intern's PNI round placed the batch's quotes as they were: a PNI ordered by hand while it waited was ordered
  a second time. pniRequote() quotes each order again just before it is placed;
- a failure and the monkey's snip took the last incident after their routing: repaired meanwhile, it was gone or
  another one. They keep their own incident before the routing, and offer a repair only while it stands.
This commit is contained in:
Antoine 2026-11-06 14:14:51 +01:00
parent 3c45d7dca1
commit f3df5e5d23
No known key found for this signature in database
GPG key ID: E1FB0C46A71DA721
8 changed files with 98 additions and 10 deletions

View file

@ -43,6 +43,9 @@ function* slAutoRun(d){if(!slAutoOn())return;const A=S.slAuto,p=slP(),w=Math.flo
// Each trial is a full routing pass: at most SL_TRIALS a day, and an offer that did not fit waits a week.
if(!reqOk(o)||tries>=SL_TRIALS||tried.get(o.id)>d-SL_RETRY)return;tries++;b=offerTrialOf(o);return true;});
if(!todo)continue;
const got=b?yield {trial:b,hx:offerHealthy(b)}:null;
// o: the offer itself, for a trial the page has to run again on the game as it is by then (dayAgain()).
const got=b?yield {trial:b,hx:offerHealthy(b),o}:null;
// Signed or declined by hand while the trial routed: it is not the desk's.
if(!S.offers.includes(o))continue;
opsQuiet(()=>{OFFER_TRIED={o,b:got};try{ACT.accept({id:o.id,auto:true});}finally{OFFER_TRIED=null;}if(!won(o))tried.set(o.id,d);});}
if(dirty)yield;}

View file

@ -206,8 +206,10 @@ const OPS_RUN={
// exchange or a PNI elsewhere, the same figure the PNI list shows. Not the city's whole demand: a network's own
// cache boxes in that POP already serve most of it (#244).
const loc=q=>pniVal(q.net,q.city).want;
for(const q of b.orders.filter(q=>opsHere('pni',q.city)&&loc(q)>=g&&(paid||NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).sort((a,b)=>loc(b)-loc(a))){
if(!X.can('pni',q.cost))break;if(X.pay('pni',()=>{if(!spend(q.cost))return false;pniPlace(q);return true;}))X.did('pni',q.city+' '+q.net);yield;}},
// Each order quoted again just before it is placed: the player may have ordered the same PNI by hand while the shift
// let a frame through or waited for a routing, and the batch's quote would order it a second time.
for(const q0 of b.orders.filter(q=>opsHere('pni',q.city)&&loc(q)>=g&&(paid||NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).sort((a,b)=>loc(b)-loc(a))){
const q=pniRequote(q0);if(!q)continue;if(!X.can('pni',q.cost))break;if(X.pay('pni',()=>{if(!spend(q.cost))return false;pniPlace(q);return true;}))X.did('pni',q.city+' '+q.net);yield;}},
// Hand back smaller waves once a bigger link between the same cities carries the pair with a quarter to spare (#102).
// Loads must include what this shift already did (a customer just signed, a repair): opsRun() routes first if a
// job changed the network and anything could go (opsDecomWaits()).