diff --git a/src/ui/selection/BufferedBuildingContent.cpp b/src/ui/selection/BufferedBuildingContent.cpp index 5ba6afc..2fff66d 100644 --- a/src/ui/selection/BufferedBuildingContent.cpp +++ b/src/ui/selection/BufferedBuildingContent.cpp @@ -29,13 +29,13 @@ std::vector toAmounts(const std::map& 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 collectItemIds(const std::map& buffered, - const std::map& perCycle, - const std::vector& handled) + const std::map& perCycle) { std::set itemIds; for (const std::pair& entry : buffered) @@ -46,7 +46,6 @@ std::set collectItemIds(const std::map& buffered, { itemIds.insert(entry.first); } - itemIds.insert(handled.begin(), handled.end()); return itemIds; } @@ -153,7 +152,7 @@ std::vector BufferedBuildingContent::buildInputEntries( std::vector 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 BufferedBuildingContent::buildOutputEntries( std::vector 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::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); } diff --git a/src/ui/selection/BufferedBuildingContent.h b/src/ui/selection/BufferedBuildingContent.h index 098e85f..dc81ad5 100644 --- a/src/ui/selection/BufferedBuildingContent.h +++ b/src/ui/selection/BufferedBuildingContent.h @@ -38,13 +38,6 @@ protected: // item any group can produce. std::vector> 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 handledInputs; - std::vector 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).