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:
parent
c137d3552d
commit
e27e9e3066
7 changed files with 87 additions and 10 deletions
|
|
@ -43,7 +43,7 @@ test('a listing is kept in the save, checked, and can be taken off the market',
|
|||
fiber(ev, 'big', 'fra', 'ams', 450);
|
||||
ev("ACT.listFiber({id:'big',w:4})");
|
||||
ev("const t=JSON.stringify(packSave(S));S=migrate(JSON.parse(t))");
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(S.links.find(l=>l.id==='big').list)")), { w: 4, p: 0 });
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(S.links.find(l=>l.id==='big').list)")), { w: 4, p: 0, hw: 4 });
|
||||
ev("const o=JSON.parse(JSON.stringify(packSave(S)));o.links.find(l=>l.id==='big').list={w:'lots',p:-3};S=migrate(o)");
|
||||
assert.equal(ev("S.links.find(l=>l.id==='big').list===undefined"), true, 'junk is dropped');
|
||||
ev("ACT.listFiber({id:'big',w:2});ACT.unlistFiber({id:'big'})");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue