allow to unlock modules when destroying defence stations
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user