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

@@ -17,7 +17,8 @@
ShipStats calculateShipStats(const GameConfig& config,
const std::string& shipId,
int level,
const std::vector<PlacedModule>& modules)
const std::vector<PlacedModule>& modules,
const std::map<std::string, int>& moduleLevelOverrides)
{
ShipStats result{};
@@ -70,7 +71,9 @@ ShipStats calculateShipStats(const GameConfig& config,
const ModuleDef* def = findModuleDef(pm.moduleId);
if (!def) { throw std::runtime_error("unknown module id '" + pm.moduleId + "'"); }
const double mx = static_cast<double>(def->playerProductionLevel);
const auto overIt = moduleLevelOverrides.find(pm.moduleId);
const double mx = static_cast<double>(
overIt != moduleLevelOverrides.end() ? overIt->second : def->playerProductionLevel);
if (def->weaponCapability)
{
@@ -108,7 +111,9 @@ ShipStats calculateShipStats(const GameConfig& config,
const ModuleDef* def = findModuleDef(pm.moduleId);
if (!def) { throw std::runtime_error("unknown module id '" + pm.moduleId + "'"); }
const double mx = static_cast<double>(def->playerProductionLevel);
const auto overIt = moduleLevelOverrides.find(pm.moduleId);
const double mx = static_cast<double>(
overIt != moduleLevelOverrides.end() ? overIt->second : def->playerProductionLevel);
for (const ModuleStatModifier& sm : def->statModifiers)
{