fix issue where items on building's output port were not counted to output display in building panel
This commit is contained in:
@@ -479,13 +479,24 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
|
|||||||
bufText += "\n";
|
bufText += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recipe && !recipe->outputs.empty())
|
// 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<std::string, int> outCounts;
|
std::map<std::string, int> outCounts;
|
||||||
for (const Item& item : b->outputBuffer.items)
|
for (const Item& item : b->outputBuffer.items)
|
||||||
{
|
{
|
||||||
outCounts[item.type.id]++;
|
outCounts[item.type.id]++;
|
||||||
}
|
}
|
||||||
|
for (const std::vector<BeltItemSlot>& lane : b->emergingItems)
|
||||||
|
{
|
||||||
|
for (const BeltItemSlot& slot : lane)
|
||||||
|
{
|
||||||
|
outCounts[slot.item.type.id]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recipe && !recipe->outputs.empty())
|
||||||
|
{
|
||||||
bufText += tr("Output: ");
|
bufText += tr("Output: ");
|
||||||
for (const RecipeOutput& out : recipe->outputs)
|
for (const RecipeOutput& out : recipe->outputs)
|
||||||
{
|
{
|
||||||
@@ -497,13 +508,8 @@ void SelectedBuildingPanel::refreshBuffers(const Building* b)
|
|||||||
+ "/" + QString::number(out.amount) + " ";
|
+ "/" + QString::number(out.amount) + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!b->outputBuffer.items.empty())
|
else if (!outCounts.empty())
|
||||||
{
|
{
|
||||||
std::map<std::string, int> outCounts;
|
|
||||||
for (const Item& item : b->outputBuffer.items)
|
|
||||||
{
|
|
||||||
outCounts[item.type.id]++;
|
|
||||||
}
|
|
||||||
bufText += tr("Output: ");
|
bufText += tr("Output: ");
|
||||||
for (const std::pair<const std::string, int>& entry : outCounts)
|
for (const std::pair<const std::string, int>& entry : outCounts)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user