implement storing recipes in blueprint

This commit is contained in:
2026-04-27 12:58:44 +02:00
parent 3da3ef5c5b
commit 541b8fdaee
4 changed files with 102 additions and 2 deletions

View File

@@ -188,6 +188,7 @@ Blueprint BlueprintPanel::createBlueprintFromSelection() const
bb.type = e.building->type;
bb.rotation = e.building->rotation;
bb.offset = e.building->anchor - center;
bb.recipeId = e.building->recipeId;
bp.buildings.push_back(bb);
}
return bp;

View File

@@ -472,7 +472,20 @@ void GameWorldView::placeBlueprintAtTile(QPoint center)
for (const BlueprintBuilding& bb : bp.buildings)
{
m_sim->tryPlaceBuilding(bb.type, center + bb.offset, bb.rotation);
const EntityId id = m_sim->tryPlaceBuilding(bb.type, center + bb.offset, bb.rotation);
if (id == kInvalidEntityId || bb.recipeId.empty()) { continue; }
if (bb.type == BuildingType::Shipyard)
{
if (m_sim->isSchematicUnlocked(bb.recipeId))
{
m_sim->buildings().setRecipe(id, bb.recipeId);
}
}
else
{
m_sim->buildings().setRecipe(id, bb.recipeId);
}
}
}