implement storing recipes in blueprint
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user