drop card state that the buffer rules make impossible

CycleInfo's handledInputs/handledOutputs were left over from the design where
the Smelter and Reprocessing Plant had an implicit recipe and so had nothing to
name between cycles. Auto-recipe buildings carry a selected recipe now, and no
subclass has populated either field since.

The output chip's cap-less branch goes with them. It stood for an item left
over from a previous recipe, but selecting a recipe clears the buffers and
sizes them for that recipe alone, and the Salvage Bay's one buffer is sized by
config -- so every chip stands for a sized buffer and the bare count was
unreachable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
2026-08-20 13:54:43 +02:00
parent 03ddc51c4b
commit 7c02b8717b
2 changed files with 13 additions and 22 deletions

View File

@@ -29,13 +29,13 @@ std::vector<RecipeLineRow::Amount> toAmounts(const std::map<std::string, int>& m
return amounts; return amounts;
} }
// Every item one side of the card should list: what the buffer holds, what a cycle // Every item one side of the card should list: what the buffer holds and what a cycle
// moves, and what the building handles at all. A building's buffers can carry items it // moves. Selecting a recipe clears the buffers and sizes them for that recipe alone
// is not currently making anything of, and an auto-recipe building between cycles names // (REQ-MAT-INPUT-BUFFER, REQ-MAT-OUTPUT-BUFFER), so the two agree wherever a recipe is
// nothing at all, so the three sources are unioned rather than one being picked. // in force. They are unioned for the sake of the Salvage Bay, which has no recipe to
// name its scrap and so is named by its buffer alone (REQ-BLD-SALVAGE-BAY).
std::set<std::string> collectItemIds(const std::map<std::string, int>& buffered, std::set<std::string> collectItemIds(const std::map<std::string, int>& buffered,
const std::map<std::string, int>& perCycle, const std::map<std::string, int>& perCycle)
const std::vector<std::string>& handled)
{ {
std::set<std::string> itemIds; std::set<std::string> itemIds;
for (const std::pair<const std::string, int>& entry : buffered) for (const std::pair<const std::string, int>& entry : buffered)
@@ -46,7 +46,6 @@ std::set<std::string> collectItemIds(const std::map<std::string, int>& buffered,
{ {
itemIds.insert(entry.first); itemIds.insert(entry.first);
} }
itemIds.insert(handled.begin(), handled.end());
return itemIds; return itemIds;
} }
@@ -153,7 +152,7 @@ std::vector<ItemChipRow::Entry> BufferedBuildingContent::buildInputEntries(
std::vector<ItemChipRow::Entry> entries; std::vector<ItemChipRow::Entry> entries;
for (const std::string& itemId : for (const std::string& itemId :
collectItemIds(buffered, cycle.perCycleInputs, cycle.handledInputs)) collectItemIds(buffered, cycle.perCycleInputs))
{ {
// An auto-recipe building's buffers are sized over every recipe of its type, // An auto-recipe building's buffers are sized over every recipe of its type,
// including recipes still locked, so those entries are left out here // including recipes still locked, so those entries are left out here
@@ -210,23 +209,22 @@ std::vector<ItemChipRow::Entry> BufferedBuildingContent::buildOutputEntries(
std::vector<ItemChipRow::Entry> entries; std::vector<ItemChipRow::Entry> entries;
for (const std::string& itemId : for (const std::string& itemId :
collectItemIds(buffered, producible, cycle.handledOutputs)) collectItemIds(buffered, producible))
{ {
if (!getContext().sim->isItemUnlocked(itemId)) { continue; } if (!getContext().sim->isItemUnlocked(itemId)) { continue; }
ItemChipRow::Entry chip; ItemChipRow::Entry chip;
chip.itemId = itemId; chip.itemId = itemId;
// Counted against this item's own buffer capacity, which is what production // Counted against this item's own buffer capacity, which is what production
// stops at (REQ-MAT-OUTPUT-BUFFER, REQ-UI-SINGLE-SELECTION). A chip for an item // stops at (REQ-MAT-OUTPUT-BUFFER, REQ-UI-SINGLE-SELECTION). Every item listed
// the building has no buffer for -- one left over from a previous recipe -- // here has one: a recipe sizes a buffer for each item it can produce and
// carries the bare count, as an unsized buffer has no denominator to state. // selecting it clears whatever the previous recipe left, so no chip stands for
// an unsized buffer.
const std::map<ItemType, int>::const_iterator capIt = const std::map<ItemType, int>::const_iterator capIt =
building.outputBuffer.caps.find(ItemType{itemId}); building.outputBuffer.caps.find(ItemType{itemId});
const int cap = const int cap =
(capIt != building.outputBuffer.caps.end()) ? capIt->second : 0; (capIt != building.outputBuffer.caps.end()) ? capIt->second : 0;
chip.countText = cap > 0 chip.countText = tr("%1 / %2").arg(lookUp(buffered, itemId)).arg(cap);
? tr("%1 / %2").arg(lookUp(buffered, itemId)).arg(cap)
: QString::number(lookUp(buffered, itemId));
chip.subLine = QString::fromStdString(toDisplayName(itemId)); chip.subLine = QString::fromStdString(toDisplayName(itemId));
entries.push_back(chip); entries.push_back(chip);
} }

View File

@@ -38,13 +38,6 @@ protected:
// item any group can produce. // item any group can produce.
std::vector<std::vector<RecipeLineRow::Amount>> perCycleOutputGroups; std::vector<std::vector<RecipeLineRow::Amount>> perCycleOutputGroups;
// Items the card lists whether or not they are currently in the buffers, for a
// building whose recipe is implicit and so has nothing to name while it sits
// between cycles (REQ-BLD-SMELTER, REQ-BLD-REPROCESSING). They carry no
// per-cycle denominator, since no one recipe is in force.
std::vector<std::string> handledInputs;
std::vector<std::string> handledOutputs;
// False when the building produces nothing at all (the Salvage Bay, // False when the building produces nothing at all (the Salvage Bay,
// REQ-BLD-SALVAGE-BAY) or has no recipe or schematic selected yet: the // REQ-BLD-SALVAGE-BAY) or has no recipe or schematic selected yet: the
// production section is then not shown (REQ-UI-PRODUCTION-PROGRESS). // production section is then not shown (REQ-UI-PRODUCTION-PROGRESS).