Fix UpdateTotals(); add debug info.
This commit is contained in:
@@ -292,9 +292,9 @@ namespace OpenRA
|
|||||||
public static void Exit() { quit = true; }
|
public static void Exit() { quit = true; }
|
||||||
|
|
||||||
public static Action<Color,string,string> AddChatLine = (c,n,s) => {};
|
public static Action<Color,string,string> AddChatLine = (c,n,s) => {};
|
||||||
|
|
||||||
public static void Debug(string s, params object[] args)
|
public static void Debug(string s, params object[] args)
|
||||||
{
|
{
|
||||||
AddChatLine(Color.White, "Debug", String.Format(s,args));
|
AddChatLine(Color.White, "Debug", String.Format(s,args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
if (a.Owner != Player || !a.HasTrait<Building>())
|
if (a.Owner != Player || !a.HasTrait<Building>())
|
||||||
return;
|
return;
|
||||||
|
Game.Debug("Added {0}: {1}",a.Info.Name, a.Trait<Building>().GetPowerUsage());
|
||||||
PowerDrain.Add(a, a.Trait<Building>().GetPowerUsage());
|
PowerDrain.Add(a, a.Trait<Building>().GetPowerUsage());
|
||||||
UpdateTotals();
|
UpdateTotals();
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
if (a.Owner != Player || !a.HasTrait<Building>())
|
if (a.Owner != Player || !a.HasTrait<Building>())
|
||||||
return;
|
return;
|
||||||
|
Game.Debug("Updated {0}: {1}->{2}",a.Info.Name, PowerDrain[a], newPower);
|
||||||
PowerDrain[a] = newPower;
|
PowerDrain[a] = newPower;
|
||||||
UpdateTotals();
|
UpdateTotals();
|
||||||
}
|
}
|
||||||
@@ -63,13 +63,15 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
if (a.Owner != Player || !a.HasTrait<Building>())
|
if (a.Owner != Player || !a.HasTrait<Building>())
|
||||||
return;
|
return;
|
||||||
|
Game.Debug("Removing {0}",a.Info.Name);
|
||||||
PowerDrain.Remove(a);
|
PowerDrain.Remove(a);
|
||||||
UpdateTotals();
|
UpdateTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateTotals()
|
void UpdateTotals()
|
||||||
{
|
{
|
||||||
|
totalProvided = 0;
|
||||||
|
totalDrained = 0;
|
||||||
foreach (var p in PowerDrain.Values)
|
foreach (var p in PowerDrain.Values)
|
||||||
{
|
{
|
||||||
if (p > 0)
|
if (p > 0)
|
||||||
@@ -77,6 +79,7 @@ namespace OpenRA.Traits
|
|||||||
else
|
else
|
||||||
totalDrained -= p;
|
totalDrained -= p;
|
||||||
}
|
}
|
||||||
|
Game.Debug("Provided: {0} Drained: {1}",totalProvided, totalDrained);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextPowerAdviceTime = 0;
|
int nextPowerAdviceTime = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user