v0.4.4 — New Game dialog for the opening hand and the three revenue rates, Yard renamed Interchange, and two movement bugs behind a mirrored consist

This commit is contained in:
Jesse
2026-08-14 22:39:50 -04:00
parent d1314066bd
commit 6655e20ea8
29 changed files with 5450 additions and 3902 deletions
+12 -7
View File
@@ -77,7 +77,8 @@ export function divisionSvg(nodes: DivisionView[]): string {
/** Nose first, no engine — drawn as blocks, loaded solid and empty hollow. */
cars?: string[];
engineAt?: number;
facing?: string;
/** East or west, always — a Division runs east and west and so does its rolling stock. */
facing?: 'e' | 'w';
region?: number;
direction?: string;
stagesLeft?: number;
@@ -291,7 +292,7 @@ export function divisionSvg(nodes: DivisionView[]): string {
*/
c.trains.forEach((t, k) => {
const cars = t.cars ?? [];
const arrow = t.facing === 'w' ? '\u25c0' : t.facing === 'e' ? '\u25b6' : t.facing === 'n' ? '\u25b2' : '\u25bc';
const arrow = t.facing === 'w' ? '\u25c0' : '\u25b6';
const loaded = cars.filter((x) => /^loaded/.test(x) || /caboose/.test(x)).length;
const label = cars.length === 0 ? `${t.label} ${arrow}` : `${t.label} ${arrow}${cars.length}`;
@@ -704,7 +705,7 @@ export function officeSvg(
kind: /^loaded/.test(c) || /caboose/.test(c) ? 'ld' : 'mt',
what: c,
}));
const arrow = t.facing === 'w' ? '\u25c0' : t.facing === 'e' ? '\u25b6' : t.facing === 'n' ? '\u25b2' : '\u25bc';
const arrow = t.facing === 'w' ? '\u25c0' : '\u25b6';
items.splice(t.engineAt, 0, { label: arrow, kind: 'eng', what: 'the engine' });
/**
* WEST ON THE LEFT, AND THE NOSE POINTING THE WAY THE ENGINE FACES.
@@ -715,15 +716,19 @@ export function officeSvg(
* drawn engine-first at the WEST end, which reads as an engine shoving four cars ahead of it.
*
* The board is a map, so the drawing has to obey the map: reverse the seating order for an
* east-facing train and its nose lands at the east end, where it is. A crew on a north-south
* spur has no left or right to be right about, so it keeps nose-left and its \u25b2/\u25bc says the rest.
* east-facing train and its nose lands at the east end, where it is.
*
* A crew on a north-south spur is drawn east-west like every other train, because `facing` is
* now always east or west (`railFacingOf`). It used to keep its compass port and draw \u25b2 or \u25bc
* with the consist pinned nose-left, which meant the one thing the picture is for \u2014 which end
* the engine is on \u2014 flipped its convention the moment a crew turned a corner. Playtested and
* reported as more confusing than a strip drawn the same way every time.
*/
const laid = t.facing === 'e' ? [...items].reverse() : items;
const cw = 17;
const tw = Math.min(W - 8, laid.length * cw + 30);
const tx = W / 2 - tw / 2;
const facingWord =
t.facing === 'e' ? 'east' : t.facing === 'w' ? 'west' : t.facing === 'n' ? 'north' : 'south';
const facingWord = t.facing === 'e' ? 'east' : 'west';
const consistWords = t.cars.length === 0 ? 'no cars' : t.cars.join(', ');
out += `<g class="bs-crew" data-tip="${esc(
`${t.label} — engine pointing ${facingWord}, carrying ${consistWords}` + (t.what ? `\n\n${t.what}` : ''),