allow the probabilistic recipe output of the reprocessing plant to yield more than 1 item of a type per cycle
This commit is contained in:
@@ -27,11 +27,14 @@ struct InputBuffer
|
||||
std::map<ItemType, int> caps; // max items per material (2× per-cycle requirement)
|
||||
};
|
||||
|
||||
// Output buffer shared by all output materials for a production building.
|
||||
// Per-material output buffer for a production building. The items are held in one
|
||||
// production-ordered queue -- that is the order they leave at the output port
|
||||
// (REQ-MAT-OUTPUT-EMERGE) -- while the capacity is per item type, so one item's backlog
|
||||
// never occupies another's room (REQ-MAT-OUTPUT-BUFFER).
|
||||
struct OutputBuffer
|
||||
{
|
||||
std::vector<Item> items;
|
||||
int capacity = 0; // 2× per-cycle output; 1× for ReprocessingPlant
|
||||
std::vector<Item> items; // production order; feeds the output belt
|
||||
std::map<ItemType, int> caps; // max items per material (2x its per-cycle amount)
|
||||
};
|
||||
|
||||
// Active production cycle for a building.
|
||||
@@ -96,6 +99,25 @@ struct Building
|
||||
return count;
|
||||
}
|
||||
|
||||
// The same over one material, which is what its own capacity is measured against
|
||||
// (REQ-MAT-OUTPUT-BUFFER).
|
||||
int getOutputItemCount(const ItemType& type) const
|
||||
{
|
||||
int count = 0;
|
||||
for (const Item& item : outputBuffer.items)
|
||||
{
|
||||
if (item.type == type) { ++count; }
|
||||
}
|
||||
for (const std::vector<BeltItemSlot>& lane : emergingItems)
|
||||
{
|
||||
for (const BeltItemSlot& slot : lane)
|
||||
{
|
||||
if (slot.item.type == type) { ++count; }
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Items currently travelling inward on each input port's virtual input belt
|
||||
// (REQ-MAT-INPUT-INTAKE); one lane per input port, parallel to inputPorts. Each
|
||||
// lane holds slots at progress [0.0, 0.5], front (highest progress) first. An
|
||||
|
||||
Reference in New Issue
Block a user