store ship module layout in shipyard blueprint

This commit is contained in:
2026-06-04 21:38:46 +02:00
parent 42b51cc6f4
commit 3e19e44f24
6 changed files with 252 additions and 18 deletions

View File

@@ -182,10 +182,11 @@ Blueprint BlueprintPanel::createBlueprintFromSelection() const
for (const Entry& e : entries)
{
BlueprintBuilding bb;
bb.type = e.building->type;
bb.rotation = e.building->rotation;
bb.offset = e.building->anchor - center;
bb.recipeId = e.building->recipeId;
bb.type = e.building->type;
bb.rotation = e.building->rotation;
bb.offset = e.building->anchor - center;
bb.recipeId = e.building->recipeId;
bb.shipLayout = e.building->shipLayout;
bp.buildings.push_back(bb);
}
return bp;

View File

@@ -504,18 +504,26 @@ void GameWorldView::placeBlueprintAtTile(QPoint center)
}
const BuildingId id = m_sim->tryPlaceBuilding(bb.type, anchor, bb.rotation);
if (id == kInvalidBuildingId || bb.recipeId.empty()) { continue; }
if (id == kInvalidBuildingId) { continue; }
if (bb.type == BuildingType::Shipyard)
if (!bb.recipeId.empty())
{
if (m_sim->isSchematicUnlocked(bb.recipeId))
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);
}
}
else
if (bb.shipLayout.has_value())
{
m_sim->buildings().setRecipe(id, bb.recipeId);
m_sim->buildings().setShipLayout(id, *bb.shipLayout);
}
}
}