Fix the game freezing when a peer drops you at a rival exchange
Peering sessions at a second or third exchange in a city are keyed like "drz@mil~2". The de-peering toast looked the city up as CITY['mil~2'], threw, and the exception stopped the animation loop for good: time and the map froze until a reload.
This commit is contained in:
parent
56e15d10dd
commit
ba1c1e1a35
2 changed files with 12 additions and 1 deletions
|
|
@ -113,3 +113,14 @@ test('DE-KICKS hides prices, haggles, harmonises upwards, auto-enrolls add-ons a
|
|||
assert.equal(ev("ixPortMo('ams',1)"), ev("Math.round(PORT[1].ix*ixMul('ams'))"), 'other IXs keep open pricing');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a peer at a rival exchange can de-peer you without stopping the game', () => {
|
||||
const { ev, errors } = load();
|
||||
ev('ACT.start({})');
|
||||
const ix = ev('Object.keys(XIXM)[0]');
|
||||
ev(`S.peers['ggl@${ix}']=true;window.snub=()=>({why:'Testing.'})`);
|
||||
ev('dayTick()');
|
||||
assert.equal(ev(`'ggl@${ix}' in S.peers`), false);
|
||||
assert.match(ev("document.getElementById('toasts').textContent"), new RegExp(`de-peered you in ${ev(`CITY[ixCity('${ix}')].name`)}`));
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue