Skip to content

Commit

Permalink
slim down the ore capacity update
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisforbes committed May 12, 2010
1 parent 77c5522 commit a4592e7
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions OpenRA.Game/Player.cs
Expand Up @@ -110,12 +110,9 @@ void UpdatePower()
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()
{
Expand All @@ -124,14 +121,6 @@ public PowerState GetPowerState()
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.
Expand Down Expand Up @@ -171,8 +160,10 @@ public bool TakeCash( int num )

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);
Expand Down

0 comments on commit a4592e7

Please sign in to comment.