From 3e7bf1880f787c60fd5d4034edaa94cfbf1f9628 Mon Sep 17 00:00:00 2001 From: rob-v Date: Thu, 18 May 2017 15:59:36 +0200 Subject: [PATCH] Fix Map editor total ore money --- OpenRA.Mods.Common/Traits/World/EditorResourceLayer.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/World/EditorResourceLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorResourceLayer.cs index e64dbbdbb7..698470d82d 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorResourceLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorResourceLayer.cs @@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Traits var t = Tiles[cell]; if (t.Density > 0) - NetWorth -= t.Density * t.Type.Info.ValuePerUnit; + NetWorth -= (t.Density + 1) * t.Type.Info.ValuePerUnit; ResourceType type; if (Resources.TryGetValue(tile.Type, out type)) @@ -153,12 +153,14 @@ namespace OpenRA.Mods.Common.Traits return t; } - NetWorth -= t.Density * type.Info.ValuePerUnit; + // Density + 1 as workaround for fixing ResourceLayer.Harvest as it would be very disruptive to balancing + if (t.Density > 0) + NetWorth -= (t.Density + 1) * type.Info.ValuePerUnit; // Set density based on the number of neighboring resources t.Density = ResourceDensityAt(c); - NetWorth += t.Density * type.Info.ValuePerUnit; + NetWorth += (t.Density + 1) * type.Info.ValuePerUnit; var sprites = type.Variants[t.Variant]; var frame = int2.Lerp(0, sprites.Length - 1, t.Density, type.Info.MaxDensity);