Added checks to make sure cash can't be < 0.

This commit is contained in:
GSonderling
2018-05-07 10:42:38 +00:00
committed by reaperrr
parent b8fd4abc4a
commit bf4dbd9b80
9 changed files with 28 additions and 35 deletions

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Activities
var hp = health != null ? (long)health.HP : 1L;
var maxHP = health != null ? (long)health.MaxHP : 1L;
var refund = (int)((sellValue * sellableInfo.RefundPercent * hp) / (100 * maxHP));
playerResources.GiveCash(refund);
refund = playerResources.ChangeCash(refund);
foreach (var ns in self.TraitsImplementing<INotifySold>())
ns.Sold(self);