Remove schematic upgrades and module and ship levels

This commit is contained in:
2026-07-02 21:32:36 +02:00
parent 81b1c7a66b
commit 18e732ae99
43 changed files with 498 additions and 666 deletions

View File

@@ -234,20 +234,17 @@ void MainWindow::handleEvent(std::shared_ptr<const LayoutDialogRequestedEvent> e
}
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(), schematicId, currentLayout,
m_layoutBlueprints,
std::move(unlockedModuleIds),
std::move(moduleLevels),
m_gameWorldView->isDebugDrawEnabled(),
this);
if (dialog.exec() == QDialog::Accepted && dialog.result().has_value())

View File

@@ -70,19 +70,6 @@ SchematicChoiceDialog::SchematicChoiceDialog(
typeLabel->setAlignment(Qt::AlignCenter);
cardLayout->addWidget(typeLabel);
QString statusText;
if (option.isNewUnlock)
{
statusText = tr("New unlock");
}
else
{
statusText = tr("Level up -> %1").arg(option.targetLevel);
}
QLabel* statusLabel = new QLabel(statusText, card);
statusLabel->setAlignment(Qt::AlignCenter);
cardLayout->addWidget(statusLabel);
QLabel* unlocksHeaderLabel = new QLabel(tr("Unlocks recipes for:"), card);
QFont unlocksHeaderFont = unlocksHeaderLabel->font();
unlocksHeaderFont.setBold(true);

View File

@@ -821,9 +821,8 @@ void SelectedBuildingPanel::buildEntityShip(entt::entity entity)
const ShipIdentityComponent& identity = admin.get<ShipIdentityComponent>(entity);
const HealthComponent& health = admin.get<HealthComponent>(entity);
m_entityTitleLabel->setText(tr("Ship: %1 (Lv %2)")
.arg(QString::fromStdString(identity.schematicId))
.arg(identity.level));
m_entityTitleLabel->setText(tr("Ship: %1")
.arg(QString::fromStdString(identity.schematicId)));
m_entityTitleLabel->show();
const ShipStats stats = buildShipStatsFromEntity(admin, entity);

View File

@@ -365,14 +365,12 @@ ShipLayoutDialog::ShipLayoutDialog(const GameConfig* config,
const ShipLayoutConfig& currentLayout,
std::vector<ShipLayoutBlueprint>& allBlueprints,
std::set<std::string> unlockedModuleIds,
std::map<std::string, int> moduleLevels,
bool debugDraw,
QWidget* parent)
: QDialog(parent)
, m_config(config)
, m_shipId(shipId)
, m_unlockedModuleIds(std::move(unlockedModuleIds))
, m_moduleLevels(std::move(moduleLevels))
, m_rows(0)
, m_cols(0)
, m_placedModules(currentLayout.placedModules)
@@ -699,16 +697,7 @@ void ShipLayoutDialog::updateGridWidget()
void ShipLayoutDialog::updateStats()
{
int level = 1;
for (const ShipDef& def : m_config->ships.ships)
{
if (def.id == m_shipId)
{
level = def.schematic.playerProductionLevel;
break;
}
}
m_statsPanel->refresh(m_shipId, level, m_placedModules, m_moduleLevels);
m_statsPanel->refresh(m_shipId, m_placedModules);
}
bool ShipLayoutDialog::canPlaceModule(const ModuleDef& def, QPoint position,

View File

@@ -27,7 +27,6 @@ public:
const ShipLayoutConfig& currentLayout,
std::vector<ShipLayoutBlueprint>& allBlueprints,
std::set<std::string> unlockedModuleIds,
std::map<std::string, int> moduleLevels,
bool debugDraw,
QWidget* parent = nullptr);
@@ -63,7 +62,6 @@ private:
const GameConfig* m_config;
std::string m_shipId;
std::set<std::string> m_unlockedModuleIds;
std::map<std::string, int> m_moduleLevels;
std::vector<std::string> m_shipLayout;
int m_rows;
int m_cols;

View File

@@ -116,12 +116,9 @@ ShipStatsPanel::ShipStatsPanel(const GameConfig* config, QWidget* parent)
}
void ShipStatsPanel::refresh(const std::string& shipId,
int level,
const std::vector<PlacedModule>& modules,
const std::map<std::string, int>& moduleLevelOverrides)
const std::vector<PlacedModule>& modules)
{
const ShipStats stats = calculateShipStats(*m_config, shipId, level, modules,
moduleLevelOverrides);
const ShipStats stats = calculateShipStats(*m_config, shipId, modules);
const QString hpText = tr("HP: %1").arg(static_cast<int>(stats.hp + 0.5f));
applyStats(stats, hpText);

View File

@@ -20,9 +20,7 @@ public:
explicit ShipStatsPanel(const GameConfig* config, QWidget* parent = nullptr);
void refresh(const std::string& shipId,
int level,
const std::vector<PlacedModule>& modules,
const std::map<std::string, int>& moduleLevelOverrides = {});
const std::vector<PlacedModule>& modules);
void refreshFromLive(const ShipStats& stats, float currentHp);