Remove World.FrameNumber.
This commit is contained in:
@@ -518,8 +518,7 @@ namespace OpenRA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var world = Game.orderManager.world;
|
var currFrame = Game.orderManager.LocalFrameNumber;
|
||||||
int currFrame = world != null ? world.FrameNumber : 0;
|
|
||||||
float atten = 1f;
|
float atten = 1f;
|
||||||
|
|
||||||
// Check if max # of instances-per-location reached:
|
// Check if max # of instances-per-location reached:
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
void Invalidate()
|
void Invalidate()
|
||||||
{
|
{
|
||||||
Hash = Sync.hash_player(self.Owner) + self.World.FrameNumber * 3;
|
Hash = Sync.hash_player(self.Owner) + self.World.WorldTick * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnumerable<CPos> FindVisibleTiles(World world, CPos position, WRange radius)
|
static IEnumerable<CPos> FindVisibleTiles(World world, CPos position, WRange radius)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace OpenRA
|
|||||||
List<IEffect> effects = new List<IEffect>();
|
List<IEffect> effects = new List<IEffect>();
|
||||||
Queue<Action<World>> frameEndActions = new Queue<Action<World>>();
|
Queue<Action<World>> frameEndActions = new Queue<Action<World>>();
|
||||||
|
|
||||||
public int FrameNumber { get { return orderManager.LocalFrameNumber; } }
|
|
||||||
public int Timestep;
|
public int Timestep;
|
||||||
|
|
||||||
internal readonly OrderManager orderManager;
|
internal readonly OrderManager orderManager;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var shellmapDecorations = widget.Get("SHELLMAP_DECORATIONS");
|
var shellmapDecorations = widget.Get("SHELLMAP_DECORATIONS");
|
||||||
shellmapDecorations.IsVisible = () => menuType != MenuType.None && Game.Settings.Game.ShowShellmap;
|
shellmapDecorations.IsVisible = () => menuType != MenuType.None && Game.Settings.Game.ShowShellmap;
|
||||||
shellmapDecorations.Get<ImageWidget>("RECBLOCK").IsVisible = () => world.FrameNumber / 25 % 2 == 0;
|
shellmapDecorations.Get<ImageWidget>("RECBLOCK").IsVisible = () => world.WorldTick / 25 % 2 == 0;
|
||||||
|
|
||||||
var shellmapDisabledDecorations = widget.Get("SHELLMAP_DISABLED_DECORATIONS");
|
var shellmapDisabledDecorations = widget.Get("SHELLMAP_DISABLED_DECORATIONS");
|
||||||
shellmapDisabledDecorations.IsVisible = () => !Game.Settings.Game.ShowShellmap;
|
shellmapDisabledDecorations.IsVisible = () => !Game.Settings.Game.ShowShellmap;
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
{
|
{
|
||||||
// Maybe we lost the owner-linked refinery:
|
// Maybe we lost the owner-linked refinery:
|
||||||
harv.OwnerLinkedProc = null;
|
harv.OwnerLinkedProc = null;
|
||||||
if (self.World.FrameNumber - chosenTicks > NextChooseTime)
|
if (self.World.WorldTick - chosenTicks > NextChooseTime)
|
||||||
{
|
{
|
||||||
harv.ChooseNewProc(self, null);
|
harv.ChooseNewProc(self, null);
|
||||||
chosenTicks = self.World.FrameNumber;
|
chosenTicks = self.World.WorldTick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
var cached = CachedPaths.FirstOrDefault(p => p.from == from && p.to == target && p.actor == self);
|
var cached = CachedPaths.FirstOrDefault(p => p.from == from && p.to == target && p.actor == self);
|
||||||
if (cached != null)
|
if (cached != null)
|
||||||
{
|
{
|
||||||
Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.FrameNumber - cached.tick);
|
Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.WorldTick - cached.tick);
|
||||||
if (world.FrameNumber - cached.tick > MaxPathAge)
|
if (world.WorldTick - cached.tick > MaxPathAge)
|
||||||
CachedPaths.Remove(cached);
|
CachedPaths.Remove(cached);
|
||||||
return new List<CPos>(cached.result);
|
return new List<CPos>(cached.result);
|
||||||
}
|
}
|
||||||
@@ -73,8 +73,8 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
CheckSanePath2(pb, from, target);
|
CheckSanePath2(pb, from, target);
|
||||||
|
|
||||||
CachedPaths.RemoveAll(p => world.FrameNumber - p.tick > MaxPathAge);
|
CachedPaths.RemoveAll(p => world.WorldTick - p.tick > MaxPathAge);
|
||||||
CachedPaths.Add(new CachedPath { from = from, to = target, actor = self, result = pb, tick = world.FrameNumber });
|
CachedPaths.Add(new CachedPath { from = from, to = target, actor = self, result = pb, tick = world.WorldTick });
|
||||||
return new List<CPos>(pb);
|
return new List<CPos>(pb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0)
|
if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (self.World.FrameNumber - lastAttackTime > info.NotifyInterval * 25)
|
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
|
||||||
{
|
{
|
||||||
Sound.PlayNotification(self.Owner, "Speech", "BaseAttack", self.Owner.Country.Race);
|
Sound.PlayNotification(self.Owner, "Speech", "BaseAttack", self.Owner.Country.Race);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA
|
|||||||
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAttackTime = self.World.FrameNumber;
|
lastAttackTime = self.World.WorldTick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (e.Attacker != null && e.Attacker.Owner == self.Owner)
|
if (e.Attacker != null && e.Attacker.Owner == self.Owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (self.World.FrameNumber - lastAttackTime > info.NotifyInterval * 25)
|
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
|
||||||
{
|
{
|
||||||
Sound.PlayNotification(self.Owner, "Speech", "HarvesterAttack", self.Owner.Country.Race);
|
Sound.PlayNotification(self.Owner, "Speech", "HarvesterAttack", self.Owner.Country.Race);
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA
|
|||||||
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAttackTime = self.World.FrameNumber;
|
lastAttackTime = self.World.WorldTick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (self.World.FrameNumber % 1500 == 1)
|
if (self.World.WorldTick % 1500 == 1)
|
||||||
UpdateEarnedThisMinute();
|
UpdateEarnedThisMinute();
|
||||||
if (self.World.FrameNumber % 250 == 0)
|
if (self.World.WorldTick % 250 == 0)
|
||||||
UpdateMapControl();
|
UpdateMapControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
if (!Panicking)
|
if (!Panicking)
|
||||||
Self.CancelActivity();
|
Self.CancelActivity();
|
||||||
PanicStartedTick = Self.World.FrameNumber;
|
PanicStartedTick = Self.World.WorldTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (!Panicking) return;
|
if (!Panicking) return;
|
||||||
|
|
||||||
if (self.World.FrameNumber >= PanicStartedTick + Info.PanicLength)
|
if (self.World.WorldTick >= PanicStartedTick + Info.PanicLength)
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
PanicStartedTick = 0;
|
PanicStartedTick = 0;
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
{
|
{
|
||||||
statusCheckbox.IsHighlighted = () => !statusCheckbox.IsChecked() &&
|
statusCheckbox.IsHighlighted = () => !statusCheckbox.IsChecked() &&
|
||||||
orderManager.LobbyInfo.FirstEmptySlot() == null &&
|
orderManager.LobbyInfo.FirstEmptySlot() == null &&
|
||||||
world.FrameNumber / 25 % 2 == 0;
|
orderManager.LocalFrameNumber / 25 % 2 == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Options panel
|
// Options panel
|
||||||
|
|||||||
@@ -285,12 +285,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
string AverageOrdersPerMinute(double orders)
|
string AverageOrdersPerMinute(double orders)
|
||||||
{
|
{
|
||||||
return (world.FrameNumber == 0 ? 0 : orders / (world.FrameNumber / 1500.0)).ToString("F1");
|
return (world.WorldTick == 0 ? 0 : orders / (world.WorldTick / 1500.0)).ToString("F1");
|
||||||
}
|
}
|
||||||
|
|
||||||
string AverageEarnedPerMinute(double earned)
|
string AverageEarnedPerMinute(double earned)
|
||||||
{
|
{
|
||||||
return "$" + (world.FrameNumber == 0 ? 0 : earned / (world.FrameNumber / 1500.0)).ToString("F2");
|
return "$" + (world.WorldTick == 0 ? 0 : earned / (world.WorldTick / 1500.0)).ToString("F2");
|
||||||
}
|
}
|
||||||
|
|
||||||
static Color GetPowerColor(PowerState state)
|
static Color GetPowerColor(PowerState state)
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace OpenRA.Mods.RA
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var qr = Game.Renderer.WorldQuadRenderer;
|
var qr = Game.Renderer.WorldQuadRenderer;
|
||||||
var doDim = refreshTick - world.FrameNumber <= 0;
|
var doDim = refreshTick - world.WorldTick <= 0;
|
||||||
if (doDim) refreshTick = world.FrameNumber + 20;
|
if (doDim) refreshTick = world.WorldTick + 20;
|
||||||
|
|
||||||
var viewBounds = wr.Viewport.CellBounds;
|
var viewBounds = wr.Viewport.CellBounds;
|
||||||
foreach (var pair in layers)
|
foreach (var pair in layers)
|
||||||
|
|||||||
Reference in New Issue
Block a user