From a57cfc7d408b94c5a11786da23be34c1d087b18b Mon Sep 17 00:00:00 2001 From: Andre Mohren Date: Thu, 26 Jul 2018 01:23:18 +0200 Subject: [PATCH] Fixed ProductionItem costs calculation. --- OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 80a98fef4c..e8c8a9f908 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -582,7 +582,8 @@ namespace OpenRA.Mods.Common.Traits return; } - var costThisFrame = RemainingCost / RemainingTime; + var expectedRemainingCost = RemainingTime == 1 ? 0 : TotalCost * RemainingTime / Math.Max(1, TotalTime); + var costThisFrame = RemainingCost - expectedRemainingCost; if (costThisFrame != 0 && !pr.TakeCash(costThisFrame, true)) return;