implement building system

This commit is contained in:
2026-04-19 20:50:42 +02:00
parent c70b5c8f08
commit bf29cc40e3
19 changed files with 1818 additions and 7 deletions

View File

@@ -135,6 +135,31 @@ std::optional<Item> BeltSystem::tryTakeItem(Port port)
return std::nullopt;
}
std::optional<ItemType> BeltSystem::peekItem(Port port) const
{
const std::map<std::pair<int, int>, BeltTile>::const_iterator it =
m_belts.find(key(port.tile));
if (it == m_belts.end())
{
return std::nullopt;
}
if (it->second.direction != port.direction)
{
return std::nullopt;
}
const BeltTile& bt = it->second;
if (bt.front)
{
return bt.front->item.type;
}
if (bt.back)
{
return bt.back->item.type;
}
return std::nullopt;
}
// ---------------------------------------------------------------------------
// Maintenance
// ---------------------------------------------------------------------------