From dfbf299055aa178e688a31f14ac69b164641a88d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 5 Dec 2009 21:49:42 +1300 Subject: [PATCH] ore capacity is worked out; proportion used is shown correctly by SILO --- OpenRa.Game/Player.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenRa.Game/Player.cs b/OpenRa.Game/Player.cs index 68216dbbc1..194479cb34 100644 --- a/OpenRa.Game/Player.cs +++ b/OpenRa.Game/Player.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Linq; +using OpenRa.Game.GameRules; namespace OpenRa.Game { @@ -48,7 +50,16 @@ namespace OpenRa.Game public float GetSiloFullness() { - return 0.5f; /* todo: work this out the same way as RA */ + return (float)Ore / GetOreCapacity(); + } + + public int GetOreCapacity() + { + return Game.world.Actors + .Where(a => a.Owner == this) + .Select(a => a.Info as BuildingInfo) + .Where(b => b != null) + .Sum(b => b.Storage); } public void GiveCash( int num ) { Cash += num; }