fixed train# specific rules. cleaned up display topline and train display on division map

This commit is contained in:
Jesse
2026-08-09 19:44:18 -04:00
parent 4a800a053a
commit 6ead39c530
14 changed files with 316 additions and 57 deletions
+27 -4
View File
@@ -152,9 +152,17 @@ function render(): void {
renderTurnChart(f);
$('revenue').textContent = String(f.revenue);
/**
* THE OBJECTIVE, WITHOUT THE COMMENTARY.
*
* It used to read "3 of 20 · 2 Days left · behind the pace (expected 8)". The score, the target and
* the Days left are what a player steers by; the pace verdict and the engine's guess at what the
* score ought to be were an opinion taking up the one line that must not wrap — and the expected
* figure came from a target that is itself an open question.
*/
const obj = $('objective');
obj.textContent = f.objective.note;
obj.className = f.objective.onPace ? 'pace good' : 'pace behind';
obj.textContent = `${f.revenue} of ${f.objective.target} · ${f.objective.daysLeft} Day${f.objective.daysLeft === 1 ? '' : 's'} left`;
obj.className = 'pace';
$('seed').textContent = String(game.seed);
// -- division
@@ -794,9 +802,24 @@ if (newBtn) {
const day = game.state.clock.day;
const started = game.state.status === 'active' && (day > 1 || game.state.clock.stage > 1);
if (started && !confirm(`Forget this game (seed ${game.seed}, Day ${day}) and deal a new one?`)) return;
/**
* ASK FOR THE SEED, rather than documenting a URL parameter in the title bar.
*
* The same deal can be replayed, shared or compared by seed, which is worth offering — it was
* offered as the note "add ?seed=1234 for a set deal", which spent width on the one line that
* must not wrap to explain a thing the button could simply ask. Blank means random.
*/
const asked = prompt('Seed for the new game — leave blank for a random one:', '');
if (asked === null) return; // cancelled
clearSave();
if (location.search === '') location.reload();
else location.search = '';
const wanted = asked.trim();
if (wanted === '') {
// No `?seed=`, so `start()` rolls one. Reload rather than re-render, to clear any seed in the URL.
if (location.search === '') location.reload();
else location.search = '';
return;
}
location.search = `?seed=${encodeURIComponent(wanted)}`;
};
}
+8 -4
View File
@@ -21,8 +21,11 @@ h3{font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--dim)
thing you most need while reading the board — which Day and Stage it is, which phase is running,
and who it is waiting on. They are one block now, and it sticks as one. */
.topbar{position:sticky;top:0;z-index:5}
/* ONE LINE, AND IT HAS TO STAY ONE LINE. The build stamp was pushed to the far right by
`margin-left:auto` and wrapped the whole row onto a second line the moment the content grew.
Tighter gaps, a smaller stamp, and nothing on here that is not worth the width. */
header{background:var(--panel);border-bottom:1px solid var(--line);
padding:9px 14px;display:flex;gap:20px;align-items:baseline;flex-wrap:wrap}
padding:8px 12px;display:flex;gap:13px;align-items:baseline;flex-wrap:wrap;font-size:13px}
header b{font-size:16px}
header button{background:#2a3038;color:inherit;border:1px solid #2c333d;border-radius:5px;padding:3px 9px;cursor:pointer;font:inherit;font-size:12px}
header button:hover{border-color:#4d6fa8}
@@ -30,7 +33,7 @@ header button:hover{border-color:#4d6fa8}
stops inviting the press. */
header button:disabled{opacity:.45;cursor:not-allowed;border-color:#2c333d}
header button:disabled:hover{border-color:#2c333d}
.build{margin-left:auto;font-size:11px;opacity:.7}
.build{margin-left:auto;font-size:10px;opacity:.55;white-space:nowrap}
.home{color:inherit;text-decoration:none;border-bottom:1px dotted #5f6b7a}
.home:hover{color:#5aa9e6}
.pace{font-size:12px;padding:1px 7px;border-radius:10px}
@@ -161,13 +164,14 @@ ul.blocked li{padding:2px 0}
<header>
<b><a href="./index.html" class="home">Station Master</a></b>
<span>Revenue <b id="revenue">0</b></span>
<!-- The objective, and nothing else: score, target, Days left. The "behind the pace" chip and the
engine's guess at what your score ought to be were noise on the one line that must not wrap. -->
<span id="objective" class="pace">—</span>
<span class="dim">seed <span id="seed">—</span></span>
<span class="dim">saved in this browser · add ?seed=1234 for a set deal</span>
<button id="sound" title="Whistle at the end of each Stage, the crossing bell at the end of each Day, and the conductor when a train is built. Currently synthesised, not recorded.">🔇 muted</button>
<button id="undo" title="Take the last action back. The save is the seed plus the moves made, so this replays the game without the last one — as far back as you like.">Undo</button>
<button id="savefile" title="Download this game as a save file you can replay or share">Save replay</button>
<button id="newgame" title="Forget the game saved in this browser and deal a fresh one. Undo steps back one action at a time; this throws the whole game away, so download the replay first if you want to keep it.">New game</button>
<button id="newgame" title="Deal a fresh game. You will be asked for a seed — leave it blank for a random one. Undo steps back one action at a time; this throws the whole game away, so download the replay first if you want to keep it.">New game</button>
<a class="home" href="./replays.html" style="font-size:12px">replays</a>
<span class="dim build" title="what is actually deployed">__BUILD__</span>
</header>