fix bug where buildings could not output directly on splitters
This commit is contained in:
@@ -199,7 +199,7 @@ void BeltSystem::reevaluateTunnelPairing()
|
||||
// Port interface
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bool BeltSystem::tryPutItem(QPoint tile, Item item)
|
||||
bool BeltSystem::tryPutItem(QPoint tile, Item item, Rotation fromDir)
|
||||
{
|
||||
const std::map<std::pair<int, int>, BeltTile>::iterator bIt = m_belts.find(key(tile));
|
||||
if (bIt != m_belts.end())
|
||||
@@ -207,6 +207,19 @@ bool BeltSystem::tryPutItem(QPoint tile, Item item)
|
||||
return tryPlaceOnBelt(tile, item);
|
||||
}
|
||||
|
||||
const std::map<std::pair<int, int>, SplitterTile>::iterator splIt =
|
||||
m_splitters.find(key(tile));
|
||||
if (splIt != m_splitters.end())
|
||||
{
|
||||
if (!splIt->second.back)
|
||||
{
|
||||
splIt->second.back = BeltItemSlot{item, 0.0};
|
||||
splIt->second.backDir = fromDir;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::map<std::pair<int, int>, TunnelEntryTile>::iterator teIt =
|
||||
m_tunnelEntries.find(key(tile));
|
||||
if (teIt != m_tunnelEntries.end())
|
||||
|
||||
@@ -72,8 +72,9 @@ public:
|
||||
// port.direction = direction items flow on that tile
|
||||
//
|
||||
// tryPutItem: place item onto tile.
|
||||
// Returns false if the tile is not a belt, or tile full.
|
||||
bool tryPutItem(QPoint tile, Item item);
|
||||
// Returns false if the tile is not a belt/splitter, or tile full.
|
||||
// fromDir: travel direction of the item (used for splitter animation).
|
||||
bool tryPutItem(QPoint tile, Item item, Rotation fromDir = Rotation::West);
|
||||
|
||||
// tryTakeItem: remove and return the leading item from port.tile.
|
||||
// Returns nullopt if tile is not a belt, direction mismatches, or tile empty.
|
||||
|
||||
@@ -713,7 +713,7 @@ void BuildingSystem::tickBeltPush()
|
||||
break;
|
||||
}
|
||||
const Item item = building.outputBuffer.items.front();
|
||||
if (m_belts.tryPutItem(outputPort.tile, item))
|
||||
if (m_belts.tryPutItem(outputPort.tile, item, outputPort.direction))
|
||||
{
|
||||
building.outputBuffer.items.erase(building.outputBuffer.items.begin());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user