From 6be6b25ef913a4b6d97e76d74b1c2c80594e1289 Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Tue, 14 Jul 2026 20:46:03 +0200 Subject: [PATCH] Count emerging items in the panel's output total The selected-building panel counted only outputBuffer.items, so items that had moved onto the output virtual belt (REQ-MAT-OUTPUT-EMERGE) disappeared from the Output line while animating. Count buffered + emerging, and drive the fallback branch off that combined count so a building whose output is entirely mid-emergence still shows its Output line. Input display unchanged. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01DZR44tA8sn4dPqDzAVXyps --- src/ui/SelectedBuildingPanel.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/ui/SelectedBuildingPanel.cpp b/src/ui/SelectedBuildingPanel.cpp index 1d6ca72..1e3ee73 100644 --- a/src/ui/SelectedBuildingPanel.cpp +++ b/src/ui/SelectedBuildingPanel.cpp @@ -479,13 +479,24 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b) bufText += "\n"; } + // Count output-side items: buffered plus still-emerging on the output belts. + // An emerging item still belongs to the output buffer (REQ-MAT-OUTPUT-EMERGE), + // so it must be included here or it would vanish from the panel while animating. + std::map outCounts; + for (const Item& item : b->outputBuffer.items) + { + outCounts[item.type.id]++; + } + for (const std::vector& lane : b->emergingItems) + { + for (const BeltItemSlot& slot : lane) + { + outCounts[slot.item.type.id]++; + } + } + if (recipe && !recipe->outputs.empty()) { - std::map outCounts; - for (const Item& item : b->outputBuffer.items) - { - outCounts[item.type.id]++; - } bufText += tr("Output: "); for (const RecipeOutput& out : recipe->outputs) { @@ -497,13 +508,8 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b) + "/" + QString::number(out.amount) + " "; } } - else if (!b->outputBuffer.items.empty()) + else if (!outCounts.empty()) { - std::map outCounts; - for (const Item& item : b->outputBuffer.items) - { - outCounts[item.type.id]++; - } bufText += tr("Output: "); for (const std::pair& entry : outCounts) {