Keep hand-listed alien waves on the market (#340)

With the capacity market selling alien waves (or pairs), its daily pass set
every fiber's listing to what the thresholds allowed: 128 waves listed by hand
came back as 96 (after the 25% kept back), or were taken off entirely when
the route's demand was below the minimum or the price below the floor.

A listing now remembers how much was listed by hand (l.list.hw / hp). The
broker lists its own share on top, capped at what the fiber has free; sales
use up the broker's share first; switching a product or route off keeps the
hand-listed part. cmClean() checks the new fields, so old saves load as before.

Fixes #340
This commit is contained in:
Frederic Jung 2026-11-11 12:06:23 +01:00
parent c137d3552d
commit e27e9e3066
No known key found for this signature in database
7 changed files with 87 additions and 10 deletions

View file

@ -1279,7 +1279,7 @@ test('#51 a dark fiber shows what is rented out, and spare capacity can be liste
assert.equal(ev("S.links[0].list?S.links[0].list.w:0"), 4 - b.slots, 'the listing shrinks by what sold');
// when every channel is lit or sold, only the spare pair in your own trench can be listed; then nothing is left
ev("const l=S.links[0];delete l.list;l.ch=Array(chMax(l)-soldSlots(l)).fill('tp16');after();ACT.listFiber({id:'df1',w:4,p:1})");
assert.deepEqual(JSON.parse(ev("JSON.stringify(S.links[0].list)")), { w: 0, p: 1 });
assert.deepEqual(JSON.parse(ev("JSON.stringify(S.links[0].list)")), { w: 0, p: 1, hp: 1 });
ev("S.biz.push({id:'p1',type:'dfpair',link:'df1',city:'fra',city2:'ams',name:'X',bw:1,rate:1,reqs:[]},{id:'p2',type:'dfpair',link:'df1',city:'fra',city2:'ams',name:'Y',bw:1,rate:1,reqs:[]});delete S.links[0].list;S.offers=[];renderPanel()");
assert.match(txt(), /Nothing spare to sell on this fiber right now/);
ev("ACT.listFiber({id:'df1',w:1,p:1})"); assert.equal(ev("S.links[0].list===undefined"), true);