slim down the ore capacity update

This commit is contained in:
Chris Forbes
2010-05-12 18:05:43 +12:00
parent 77c5522602
commit a4592e7019

View File

@@ -110,12 +110,9 @@ namespace OpenRA
if (PowerProvided - PowerDrained < 0)
if (PowerProvided - PowerDrained != oldBalance)
GiveAdvice(World.WorldActor.Info.Traits.Get<EvaAlertsInfo>().LowPower);
}
public float GetSiloFullness()
{
return (float)Ore / OreCapacity;
}
}
public float GetSiloFullness() { return (float)Ore / OreCapacity; }
public PowerState GetPowerState()
{
@@ -124,14 +121,6 @@ namespace OpenRA
return PowerState.Critical;
}
void UpdateOreCapacity()
{
OreCapacity = World.Queries.OwnedBy[this]
.Where(a => a.traits.Contains<StoresOre>())
.Select(a => a.Info.Traits.Get<StoresOreInfo>())
.Sum(b => b.Capacity);
}
void GiveAdvice(string advice)
{
// todo: store the condition or something.
@@ -171,8 +160,10 @@ namespace OpenRA
public void Tick()
{
UpdatePower();
UpdateOreCapacity();
UpdatePower();
OreCapacity = World.Queries.OwnedBy[this].WithTrait<StoresOre>()
.Sum(a => a.Actor.Info.Traits.Get<StoresOreInfo>().Capacity);
var totalMoney = Cash + Ore;
var diff = Math.Abs(totalMoney - DisplayCash);