Commit graph

4 commits

Author SHA1 Message Date
Antoine
fca11b39d2
fix(map): drop the last network's floaters when another one starts
Floaters ("New POP!", payday money) live in FLOATS and fade on the map's
animation clock, which only runs while the game does. A new network
whose clock stands still (the agent's clock on the development page)
kept the previous network's floaters frozen over its map until a reload:
hundreds of them after a payday on a big network at 8x.

Each floater now records the network that raised it, and the map drops
any that belong to another one (new game, another slot, import, puzzle,
title screen). Same code for the 2D and WebGL maps.
2026-11-05 21:40:13 +01:00
Frederic Jung
dd6e4f4f8a
Fix CodeQL code-scanning alerts
- Values pasted into eval'd or inline-script code go through lit() (scripts/lib/js-literal.js), which escapes <, >, /, U+2028 and U+2029 after JSON.stringify
- build test and i18n-check read script tags with a DOM parser or a plain search, not HTML regexes
- mcp.js parses the Authorization header without a backtracking regex
2026-11-05 21:24:26 +01:00
Frederic Jung
7f4fdf6043
WebGL map: join each line's segments, and draw a link being dragged out under the cities
A see-through line on the card was one round-ended quad per segment, so
where two met it was blended twice: the selected tube's halo showed a
darker blob at every point, and the cables a notch at every corner. Each
segment now knows its neighbours' directions and keeps only its side of
the corner's bisector, as the 2D canvas strokes a path once.

The link being dragged out was painted on the overlay, above the cities
and their labels; it now goes to the card, under them, as in 2D, and its
price label is a picture like the others.

Auto after Always 2D, when the browser will not give the context back,
gives the card up instead of waiting for it all session. Firefox reads
the card's name from RENDERER, without the extension it warns about.
2026-11-05 11:15:05 +01:00
Antoine
fb76a1e6fd
2D map: draw the pictures with the map's own pen, as main did
Cities, markers and labels are now pictures painted once on a canvas of their own. Drawn straight on the map,
main's dashed rings (the selected city, the cities feeding a selected tube, a flood), the cones' tips, a sleeping
POP's "zzz" and a working cable ship's spark took the state the tubes and labels left on the map's canvas: round
line ends and corners, text centred on its middle. A new canvas starts with square ends and text on its baseline, so
the rings came out with square dashes and the "zzz" sat higher. Every picture now starts with that pen (sprPen()),
on the card's shared canvas too.

tests/map-2d.test.js holds the 2D map to main, for players who keep it:
- for the same state, a frame drawn from the kept pictures is, call for call, the frame painted with no cache at
  all: over every state a POP can be in, a city without a POP, random views of the big network with days passing,
  and seeded random games after every move and day (the route-fuzz driver, two pages in lockstep);
- every tube's width, colour, dash and packets follow main's formulas;
- the 2D map never asks for WebGL, never draws a picture without a canvas, keeps one canvas per picture, draws as
  a 2D map after the card is switched off or lost, and paints again at a new pixel density;
- money pop-ups fade as before; every picture starts with the right pen.
Planted bugs (incomplete keys, a stale key memo, the tubes' looks kept without the routing, one shared 2D canvas,
no pen) each fail it. A pixel comparison with main in Chromium (desktop and phone, the fixture, a late-game save and
states from random games) found the pen and nothing else beyond sub-pixel edges.
2026-11-04 22:37:14 +01:00