implement ui

This commit is contained in:
2026-04-20 20:33:37 +02:00
parent 498b97db20
commit 94123e93d6
19 changed files with 2312 additions and 19 deletions

View File

@@ -389,6 +389,25 @@ bool Simulation::isBlueprintUnlocked(const std::string& shipId) const
return it->second.unlocked;
}
EntityId Simulation::tryPlaceBuilding(BuildingType type, QPoint anchor, Rotation rotation)
{
int cost = 0;
for (const BuildingDef& def : m_config.buildings.buildings)
{
if (def.type == type)
{
cost = def.cost;
break;
}
}
if (m_buildingBlocksStock < cost)
{
return kInvalidEntityId;
}
m_buildingBlocksStock -= cost;
return m_buildingSystem->place(type, anchor, rotation, m_currentTick);
}
BuildingSystem& Simulation::buildings()
{
return *m_buildingSystem;