Fix a time format bug. Fix subsequent gps bug.

This commit is contained in:
Paul Chote
2010-12-05 23:04:33 +13:00
parent c465a58976
commit d1850e8b4b
2 changed files with 14 additions and 14 deletions

View File

@@ -132,7 +132,7 @@ namespace OpenRA.Widgets
public static string FormatTime(int ticks)
{
var seconds = ticks / 25;
var seconds = (int)Math.Ceiling(ticks / 25f);
var minutes = seconds / 60;
if (minutes >= 60)

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA
{
var key = (t.Info.AllowMultiple) ? t.Info.OrderName+"_"+a.ActorID : t.Info.OrderName;
Powers[key].Instances.Remove(t);
if (Powers[key].Instances.Count == 0)
if (Powers[key].Instances.Count == 0 && !Powers[key].Disabled)
Powers.Remove(key);
}
}
@@ -96,14 +96,14 @@ namespace OpenRA.Mods.RA
public class SupportPowerInstance
{
SupportPowerManager Manager;
string Key;
readonly SupportPowerManager Manager;
readonly string Key;
public List<SupportPower> Instances;
public int RemainingTime;
public int TotalTime;
public bool Active;
public bool Disabled;
public bool Active { get; private set; }
public bool Disabled { get; private set; }
public SupportPowerInfo Info { get { return Instances.First().Info; } }
public bool Ready { get { return Active && RemainingTime == 0; } }
@@ -119,17 +119,16 @@ namespace OpenRA.Mods.RA
public void Tick()
{
Active = !Disabled && Instances.Any(i => !i.self.TraitsImplementing<IDisable>().Any(d => d.Disabled));
var power = Instances.First();
if (Active)
{
var power = Instances.First();
if (RemainingTime > 0) --RemainingTime;
if (!notifiedCharging)
{
power.Charging(power.self, Key);
notifiedCharging = true;
}
}
if (RemainingTime == 0
&& !notifiedReady)
@@ -138,6 +137,7 @@ namespace OpenRA.Mods.RA
notifiedReady = true;
}
}
}
public void Target()
{