Try to win a small amount of performance when the shellmap is disabled

This commit is contained in:
abcdefg30
2015-12-23 14:07:09 +01:00
parent 4b2df6d133
commit 64f57ac9a5
3 changed files with 12 additions and 6 deletions

View File

@@ -483,7 +483,11 @@ namespace OpenRA
Sound.Tick();
Sync.CheckSyncUnchanged(world, orderManager.TickImmediate);
if (world != null)
if (world == null)
return;
// Don't tick when the shellmap is disabled
if (world.ShouldTick)
{
var isNetTick = LocalTick % NetTickScale == 0;
@@ -506,12 +510,13 @@ namespace OpenRA
PerfHistory.Tick();
}
else
if (orderManager.NetFrameNumber == 0)
orderManager.LastTickTime = RunTime;
else if (orderManager.NetFrameNumber == 0)
orderManager.LastTickTime = RunTime;
Sync.CheckSyncUnchanged(world, () => world.TickRender(worldRenderer));
}
else
PerfHistory.Tick();
}
}
}

View File

@@ -260,6 +260,7 @@ namespace OpenRA
public event Action<Actor> ActorAdded = _ => { };
public event Action<Actor> ActorRemoved = _ => { };
public bool ShouldTick { get { return Type != WorldType.Shellmap || Game.Settings.Game.ShowShellmap; } }
public bool Paused { get; internal set; }
public bool PredictedPaused { get; internal set; }
public bool PauseStateLocked { get; set; }
@@ -282,7 +283,7 @@ namespace OpenRA
public void Tick()
{
if (!Paused && (Type != WorldType.Shellmap || Game.Settings.Game.ShowShellmap))
if (!Paused)
{
WorldTick++;

View File

@@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.Widgets
Game.Sound.StopVideo();
video.Reset();
videoSprite.Sheet.GetTexture().SetData(video.FrameData);
world.AddFrameEndTask(_ => onComplete());
Game.RunAfterTick(onComplete);
}
public void CloseVideo()