Phase 2: client military/social screens, WebSocket push, trade + endgame, review findings pending
Built: units/movements/reports/send/expansion screens, alliance/messages/rankings screens, ws client + server /ws push (docs/PROTOCOL.md), Internet exchange trade, backbone endgame + world end, shared reports, buildDone relative levels. Tested: npm test 175/175. Two adversarial reviews found issues (trade-leg recall exploit, __proto__ via validate.js, rankings DoS, static headers, ...): fixes follow in the next commit. NOT done: bots/balance, e2e suite, real-device checks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
249818a7aa
commit
b18645dca1
87 changed files with 10201 additions and 71 deletions
|
|
@ -46,10 +46,12 @@ function launchReturn(ctx, o) {
|
|||
});
|
||||
}
|
||||
|
||||
// Transport links in use by a POP: transports it sent that are still out, plus the empty return legs of transports.
|
||||
// Transport links in use by a POP: transports it sent that are still out, plus the empty return legs of transports, plus the
|
||||
// open Internet exchange offers it posted (an open offer holds a link in reserve: accepting it sends the escrow on that link).
|
||||
function activeLinks(db, townId) {
|
||||
return db.get(`SELECT COUNT(*) AS n FROM movements WHERE status = 'out' AND
|
||||
((type = 'transport' AND from_town_id = ?) OR (type = 'return' AND to_town_id = ? AND json_extract(extra, '$.link') = 1))`, townId, townId).n;
|
||||
((type = 'transport' AND from_town_id = ?) OR (type = 'return' AND to_town_id = ? AND json_extract(extra, '$.link') = 1))`, townId, townId).n
|
||||
+ db.get("SELECT COUNT(*) AS n FROM trade_offers WHERE town_id = ? AND status = 'open'", townId).n;
|
||||
}
|
||||
|
||||
// Hooks for later stages (trade): called after a transport has been delivered. fn(ctx, movement, { added, lost }).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue