Skip to content

Fix missing boat sprite icon in attacks panel#4141

Open
camclark wants to merge 2 commits into
openfrontio:mainfrom
camclark:fix/4100-boat-sprite-icon
Open

Fix missing boat sprite icon in attacks panel#4141
camclark wants to merge 2 commits into
openfrontio:mainfrom
camclark:fix/4100-boat-sprite-icon

Conversation

@camclark
Copy link
Copy Markdown
Contributor

@camclark camclark commented Jun 3, 2026

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:

  • I have added screenshots for all UI updates
  • 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)
  • 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

Call loadAllSprites() from AttacksDisplay.init() so the sprite map is
populated at startup. It was previously loaded by a deleted canvas layer,
leaving the map empty and causing boat row icons to render blank.

Fixes openfrontio#4100
@camclark camclark requested a review from a team as a code owner June 3, 2026 08:46
@github-actions github-actions Bot added the small-fix Small fix (≤ 50 lines) — auto-applied by PR gate label Jun 3, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Walkthrough

AttacksDisplay imports and calls SpriteLoader.loadAllSprites() during init() (async) with error logging, ensuring sprites are preloaded so tinted boat icons can be rendered in the attacks panel.

Changes

Sprite Preloading in AttacksDisplay

Layer / File(s) Summary
Sprite preloading initialization
src/client/hud/layers/AttacksDisplay.ts
Import loadAllSprites from SpriteLoader and call it asynchronously in init() with .catch logging to populate the sprite map used for boat icon rendering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

small-fix

Suggested reviewers

  • evanpelle

Poem

Sprites slept silent behind the scenes,
Now warmed by a call at init routines,
Boats wear their colors, bright and bold,
The attacks panel shows what stories told,
Little icons saved the day — behold! 🚢✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: restoring the missing boat sprite icon in the attacks panel UI.
Linked Issues check ✅ Passed The PR fully addresses the objectives from #4100 by calling loadAllSprites() in AttacksDisplay.init() to populate the sprite map and enable boat icon rendering.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the missing boat sprite icon; only AttacksDisplay.ts is modified to implement the required sprite preloading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly relates to the changeset, detailing the root cause (missing sprite preload call), the fix (calling loadAllSprites() from AttacksDisplay.init()), and providing supporting evidence including demo screenshots.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small-fix Small fix (≤ 50 lines) — auto-applied by PR gate

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Bug: Boat row missing its sprite icon in the attacks panel

1 participant