Render produced-item icons in recipe dialog and game world
Implements REQ-UI-ITEM-ICON and REQ-UI-RECIPE-ICON. Adds an optional recipes.toml `icon` field (an item id; defaults to the recipe's first output). New ItemIconCache loads per-item SVGs from icons/items and caches pixmaps per target pixel size, shared by: - the Miner/Assembler recipe-selection dialog, which now shows icon-only option buttons (name-caption fallback when no icon file exists), and - GameWorldView belt/port item rendering via a shared drawWorldItem helper (colored-square fallback preserved). Shipyard schematic dialog is unchanged. No icon art is shipped; every path falls back cleanly when an item has no SVG. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc
This commit is contained in:
@@ -32,6 +32,10 @@ struct RecipeDef
|
||||
std::vector<RecipeIngredient> inputs;
|
||||
std::vector<RecipeOutput> outputs;
|
||||
double durationSeconds;
|
||||
// Optional id of the item whose icon represents this recipe in the recipe-
|
||||
// selection dialog (REQ-UI-RECIPE-ICON). When unset, the first output item is
|
||||
// used. A missing icon file for that item is not an error (REQ-UI-ITEM-ICON).
|
||||
std::optional<std::string> icon;
|
||||
// Assembler only. When true, this recipe is available from game start
|
||||
// regardless of the implicit item graph — used for base recipes that no
|
||||
// schematic's materials reach (e.g. building blocks). See REQ-LOCK-IMPLICIT.
|
||||
|
||||
Reference in New Issue
Block a user