From 4035c523cbd1ae6e35d723e45e8de2c7237b22c3 Mon Sep 17 00:00:00 2001 From: wtclaude Date: Tue, 29 Sep 2026 18:19:31 -0500 Subject: [PATCH] fix(rust): the fleet's label list prefers a capitalised spelling Found on the walk: the game spells one label "jungle swamp" on both rigs' maps, and the fleet list printed it that way beside the minor list's "Jungle Swamp". Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY --- client/src/lib/mapMarkers.js | 18 ++++++++++-------- client/test/mapMarkers.test.js | 5 +++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/client/src/lib/mapMarkers.js b/client/src/lib/mapMarkers.js index b927454..e7b685a 100644 --- a/client/src/lib/mapMarkers.js +++ b/client/src/lib/mapMarkers.js @@ -41,17 +41,19 @@ export function serverShows(minorLabels, fleetMarkers, serverMarkers, key) { */ export function fleetLabels(minorLabels, servers) { const byKey = new Map() - for (const s of servers || []) { - for (const l of s.markerLabels || []) { - const seen = byKey.get(l.key) - if (seen) seen.count += l.count || 0 - else byKey.set(l.key, { key: l.key, label: l.label, count: l.count || 0 }) + // A capitalised spelling wins over the game's lower-case one ("jungle swamp"). + const add = (key, label, count) => { + const seen = byKey.get(key) + if (!seen) byKey.set(key, { key, label, count }) + else { + seen.count += count + if (seen.label === seen.label.toLowerCase() && label !== label.toLowerCase()) seen.label = label } } - for (const label of minorLabels || []) { - const key = markerKey(label) - if (!byKey.has(key)) byKey.set(key, { key, label, count: 0 }) + for (const s of servers || []) { + for (const l of s.markerLabels || []) add(l.key, l.label, l.count || 0) } + for (const label of minorLabels || []) add(markerKey(label), label, 0) return [...byKey.values()].sort((a, b) => a.label.localeCompare(b.label)) } diff --git a/client/test/mapMarkers.test.js b/client/test/mapMarkers.test.js index 62074b3..0d6af74 100644 --- a/client/test/mapMarkers.test.js +++ b/client/test/mapMarkers.test.js @@ -47,6 +47,11 @@ test('the fleet list is every server’s labels and the minor list, each once', ) }) +test('the fleet list shows a capitalised spelling where the game only wrote lower case', () => { + const labels = fleetLabels(MINOR, [{ markerLabels: [{ key: 'jungle swamp', label: 'jungle swamp', count: 3 }] }]) + assert.deepEqual(labels.find((l) => l.key === 'jungle swamp'), { key: 'jungle swamp', label: 'Jungle Swamp', count: 3 }) +}) + test('setting the fleet back to the built-in answer clears the row instead of copying it', () => { assert.deepEqual(setFleet(MINOR, {}, 'substation', true), { substation: true }) assert.deepEqual(setFleet(MINOR, { substation: true }, 'substation', false), {})