From e38b25f20601df205ba95e26583934cbae6f2fd9 Mon Sep 17 00:00:00 2001 From: Cameron Clark Date: Thu, 11 Jun 2026 06:39:53 +1000 Subject: [PATCH] Fix missing boat sprite icon in attacks panel (#4141) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #4100 ## Description: The boat row in the attacks panel (bottom-right UI) rendered an empty slot where the tinted boat sprite icon should appear, for both incoming and outgoing transport boats. Root cause: `loadAllSprites()` in `SpriteLoader.ts` was never called. It was previously invoked by a canvas layer that has since been deleted, so the sprite map stayed empty. As a result `getColoredSprite()` threw, `AttacksDisplay.getBoatSpriteDataURL()` caught the error and returned `""`, and the icon rendered blank. This fix calls `loadAllSprites()` from `AttacksDisplay.init()` (currently the only consumer of the sprite loader), so the sprite map is populated at startup. ### Demo after fix: CleanShot 2026-06-03 at 18 51 01 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file (N/A — no user-facing text added; only a console error log) - [x] I have added relevant tests to the test directory (smoke tested locally, see demo recording above) ## Please put your Discord username so you can be contacted if a bug or regression is found: cool_clarky --- src/client/hud/GameRenderer.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/client/hud/GameRenderer.ts b/src/client/hud/GameRenderer.ts index ea48a58a1..43aa826f5 100644 --- a/src/client/hud/GameRenderer.ts +++ b/src/client/hud/GameRenderer.ts @@ -2,9 +2,6 @@ import { EventBus } from "../../core/EventBus"; import { GameView } from "../../core/game/GameView"; import { UserSettings } from "../../core/game/UserSettings"; import { Controller } from "../Controller"; -import { GameStartingModal } from "../GameStartingModal"; -import { TransformHandler } from "../TransformHandler"; -import { UIState } from "../UIState"; import { AttackingTroopsController } from "../controllers/AttackingTroopsController"; import { BuildPreviewController } from "../controllers/BuildPreviewController"; import { HoverHighlightController } from "../controllers/HoverHighlightController"; @@ -12,7 +9,10 @@ import { SoundEffectController } from "../controllers/SoundEffectController"; import { StructureHighlightController } from "../controllers/StructureHighlightController"; import { ViewModeController } from "../controllers/ViewModeController"; import { WarshipSelectionController } from "../controllers/WarshipSelectionController"; +import { GameStartingModal } from "../GameStartingModal"; import { GameView as WebGLGameView } from "../render/gl"; +import { TransformHandler } from "../TransformHandler"; +import { UIState } from "../UIState"; import { FrameProfiler } from "./FrameProfiler"; import { ActionableEvents } from "./layers/ActionableEvents"; import { AlertFrame } from "./layers/AlertFrame"; @@ -41,6 +41,7 @@ import { SpawnTimer } from "./layers/SpawnTimer"; import { TeamStats } from "./layers/TeamStats"; import { UnitDisplay } from "./layers/UnitDisplay"; import { WinModal } from "./layers/WinModal"; +import { loadAllSprites } from "./SpriteLoader"; export function createRenderer( inputEl: HTMLElement, @@ -350,6 +351,10 @@ export class GameRenderer { ) {} initialize() { + loadAllSprites().catch((err) => + console.error("Failed to preload sprites:", err), + ); + this.layers.forEach((l) => l.init?.()); window.addEventListener("resize", () =>