allow to unlock modules when destroying defence stations

This commit is contained in:
2026-06-10 21:43:48 +02:00
parent aad094f842
commit af96b95f61
19 changed files with 203 additions and 51 deletions

View File

@@ -1,5 +1,8 @@
#include "MainWindow.h"
#include <map>
#include <set>
#include <QApplication>
#include <QCloseEvent>
#include <QFile>
@@ -233,8 +236,22 @@ void MainWindow::onLayoutDialogRequested(BuildingId shipyardId)
currentLayout = *b->shipLayout;
}
std::set<std::string> unlockedModuleIds;
std::map<std::string, int> moduleLevels;
for (const ModuleDef& def : m_sim->config().modules.modules)
{
if (m_sim->isModuleSchematicUnlocked(def.id))
{
unlockedModuleIds.insert(def.id);
}
moduleLevels[def.id] = m_sim->moduleSchematicLevel(def.id);
}
ShipLayoutDialog dialog(&m_sim->config(), b->recipeId, currentLayout,
m_layoutBlueprints, this);
m_layoutBlueprints,
std::move(unlockedModuleIds),
std::move(moduleLevels),
this);
if (dialog.exec() == QDialog::Accepted && dialog.result().has_value())
{
m_sim->buildings().setShipLayout(shipyardId, *dialog.result());