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:
@@ -29,13 +29,13 @@ std::vector<RecipeLineRow::Amount> toAmounts(const std::map<std::string, int>& m
|
||||
return amounts;
|
||||
}
|
||||
|
||||
// Every item one side of the card should list: what the buffer holds, what a cycle
|
||||
// moves, and what the building handles at all. A building's buffers can carry items it
|
||||
// is not currently making anything of, and an auto-recipe building between cycles names
|
||||
// nothing at all, so the three sources are unioned rather than one being picked.
|
||||
// Every item one side of the card should list: what the buffer holds and what a cycle
|
||||
// moves. Selecting a recipe clears the buffers and sizes them for that recipe alone
|
||||
// (REQ-MAT-INPUT-BUFFER, REQ-MAT-OUTPUT-BUFFER), so the two agree wherever a recipe is
|
||||
// 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,
|
||||
const std::map<std::string, int>& perCycle,
|
||||
const std::vector<std::string>& handled)
|
||||
const std::map<std::string, int>& perCycle)
|
||||
{
|
||||
std::set<std::string> itemIds;
|
||||
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(handled.begin(), handled.end());
|
||||
return itemIds;
|
||||
}
|
||||
|
||||
@@ -153,7 +152,7 @@ std::vector<ItemChipRow::Entry> BufferedBuildingContent::buildInputEntries(
|
||||
|
||||
std::vector<ItemChipRow::Entry> entries;
|
||||
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,
|
||||
// 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;
|
||||
for (const std::string& itemId :
|
||||
collectItemIds(buffered, producible, cycle.handledOutputs))
|
||||
collectItemIds(buffered, producible))
|
||||
{
|
||||
if (!getContext().sim->isItemUnlocked(itemId)) { continue; }
|
||||
|
||||
ItemChipRow::Entry chip;
|
||||
chip.itemId = itemId;
|
||||
// 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
|
||||
// the building has no buffer for -- one left over from a previous recipe --
|
||||
// carries the bare count, as an unsized buffer has no denominator to state.
|
||||
// stops at (REQ-MAT-OUTPUT-BUFFER, REQ-UI-SINGLE-SELECTION). Every item listed
|
||||
// here has one: a recipe sizes a buffer for each item it can produce and
|
||||
// selecting it clears whatever the previous recipe left, so no chip stands for
|
||||
// an unsized buffer.
|
||||
const std::map<ItemType, int>::const_iterator capIt =
|
||||
building.outputBuffer.caps.find(ItemType{itemId});
|
||||
const int cap =
|
||||
(capIt != building.outputBuffer.caps.end()) ? capIt->second : 0;
|
||||
chip.countText = cap > 0
|
||||
? tr("%1 / %2").arg(lookUp(buffered, itemId)).arg(cap)
|
||||
: QString::number(lookUp(buffered, itemId));
|
||||
chip.countText = tr("%1 / %2").arg(lookUp(buffered, itemId)).arg(cap);
|
||||
chip.subLine = QString::fromStdString(toDisplayName(itemId));
|
||||
entries.push_back(chip);
|
||||
}
|
||||
|
||||
@@ -38,13 +38,6 @@ protected:
|
||||
// item any group can produce.
|
||||
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,
|
||||
// REQ-BLD-SALVAGE-BAY) or has no recipe or schematic selected yet: the
|
||||
// production section is then not shown (REQ-UI-PRODUCTION-PROGRESS).
|
||||
|
||||
Reference in New Issue
Block a user