Fix free-of-charge repairing still costing credits

This commit is contained in:
abcdefg30
2020-10-19 12:53:17 +02:00
committed by abcdefg30
parent 2cea4b26e8
commit 7b75a78e38

View File

@@ -272,7 +272,8 @@ namespace OpenRA.Mods.Common.Activities
var hpToRepair = repairable != null && repairable.Info.HpPerStep > 0 ? repairable.Info.HpPerStep : repairsUnits.Info.HpPerStep;
// Cast to long to avoid overflow when multiplying by the health
var cost = Math.Max(1, (int)(((long)hpToRepair * unitCost * repairsUnits.Info.ValuePercentage) / (health.MaxHP * 100L)));
var value = (long)unitCost * repairsUnits.Info.ValuePercentage;
var cost = value == 0 ? 0 : Math.Max(1, (int)(hpToRepair * value / (health.MaxHP * 100L)));
if (!played)
{