fix issue where upgrade modules are not working properly

This commit is contained in:
2026-06-09 22:58:48 +02:00
parent 121cd5407f
commit 510e37c37b
6 changed files with 419 additions and 13 deletions

View File

@@ -157,6 +157,22 @@ ShipStats calculateShipStats(const GameConfig& config,
}
}
// Acceleration additive modifiers are in m/s² in config; convert to tiles/s².
const char* const kAccelerationStats[] = {
"main_acceleration", "maneuvering_acceleration"
};
for (const char* stat : kAccelerationStats)
{
for (std::map<std::string, std::pair<double, double>>* mods : allModMaps)
{
std::map<std::string, std::pair<double, double>>::iterator it = mods->find(stat);
if (it != mods->end())
{
it->second.second /= tileSize;
}
}
}
auto applyMod = [](float& stat, const std::string& name,
const std::map<std::string, std::pair<double, double>>& mods)
{