diff --git a/OpenRA.Mods.Common/Traits/Crates/GiveCashCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GiveCashCrateAction.cs index f9c71669da..85c85cbd5a 100644 --- a/OpenRA.Mods.Common/Traits/Crates/GiveCashCrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/GiveCashCrateAction.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public override int GetSelectionShares(Actor collector) { var pr = collector.Owner.PlayerActor.Trait(); - if (info.Amount < 0 && pr.Cash + pr.Resources == 0) + if (info.Amount < 0 && pr.GetCashAndResources() == 0) return 0; return base.GetSelectionShares(collector); diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index cfca24bc42..d6d29dcf52 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Traits else { // Don't put the player into negative funds - amount = Math.Max(-(Cash + Resources), amount); + amount = Math.Max(-GetCashAndResources(), amount); TakeCash(-amount); } @@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Traits public bool TakeCash(int num, bool notifyLowFunds = false) { - if (Cash + Resources < num) + if (GetCashAndResources() < num) { if (notifyLowFunds && Game.RunTime > lastNotificationTime + Info.InsufficientFundsNotificationInterval) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs index 08acbc06a7..65034deb55 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameCashCounterLogic.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.world = world; player = world.LocalPlayer; playerResources = player.PlayerActor.Trait(); - displayResources = playerResources.Cash + playerResources.Resources; + displayResources = playerResources.GetCashAndResources(); siloUsageTooltipCache = new CachedTransform<(int Resources, int Capacity), string>(x => TranslationProvider.GetString(SiloUsage, Translation.Arguments("usage", x.Resources, "capacity", x.Capacity))); @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (nextCashTickTime > 0) nextCashTickTime--; - var actual = playerResources.Cash + playerResources.Resources; + var actual = playerResources.GetCashAndResources(); var diff = Math.Abs(actual - displayResources); var move = Math.Min(Math.Max((int)(diff * DisplayFracPerFrame), DisplayDeltaPerFrame), diff); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index 1f422f0cdd..457d7d8ba7 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -432,7 +432,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var res = player.PlayerActor.Trait(); var cashText = new CachedTransform(i => "$" + i); - template.Get("CASH").GetText = () => cashText.Update(res.Cash + res.Resources); + template.Get("CASH").GetText = () => cashText.Update(res.GetCashAndResources()); var incomeText = new CachedTransform(i => "$" + i); template.Get("INCOME").GetText = () => incomeText.Update(stats.DisplayIncome); @@ -477,7 +477,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var res = player.PlayerActor.Trait(); var cashText = new CachedTransform(i => "$" + i); - template.Get("CASH").GetText = () => cashText.Update(res.Cash + res.Resources); + template.Get("CASH").GetText = () => cashText.Update(res.GetCashAndResources()); var powerRes = player.PlayerActor.TraitOrDefault(); if (powerRes != null) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs index 4ed956369b..0014edf3fb 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs @@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var timeSize = font.Measure(timeLabel.Text); costLabel.Text = cost.ToString(NumberFormatInfo.CurrentInfo); - costLabel.GetColor = () => pr.Cash + pr.Resources >= cost ? Color.White : Color.Red; + costLabel.GetColor = () => pr.GetCashAndResources() >= cost ? Color.White : Color.Red; var costSize = font.Measure(costLabel.Text); descLabel.Text = buildable.Description.Replace("\\n", "\n");