Fix missing boat sprite icon in attacks panel#4141
Conversation
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
WalkthroughAttacksDisplay 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. ChangesSprite Preloading in AttacksDisplay
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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. Comment |
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()inSpriteLoader.tswas never called. It was previously invoked by a canvas layer that has since been deleted, so the sprite map stayed empty. As a resultgetColoredSprite()threw,AttacksDisplay.getBoatSpriteDataURL()caught the error and returned"", and the icon rendered blank.This fix calls
loadAllSprites()fromAttacksDisplay.init()(currently the only consumer of the sprite loader), so the sprite map is populated at startup.Demo after fix:
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
cool_clarky