Merge pull request #10089 from abcdefg30/shellmapCPU
Try to win a small amount of performance when the shellmap is disabled
This commit is contained in:
@@ -491,7 +491,11 @@ namespace OpenRA
|
|||||||
Sound.Tick();
|
Sound.Tick();
|
||||||
Sync.CheckSyncUnchanged(world, orderManager.TickImmediate);
|
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;
|
var isNetTick = LocalTick % NetTickScale == 0;
|
||||||
|
|
||||||
@@ -517,12 +521,13 @@ namespace OpenRA
|
|||||||
|
|
||||||
PerfHistory.Tick();
|
PerfHistory.Tick();
|
||||||
}
|
}
|
||||||
else
|
else if (orderManager.NetFrameNumber == 0)
|
||||||
if (orderManager.NetFrameNumber == 0)
|
|
||||||
orderManager.LastTickTime = RunTime;
|
orderManager.LastTickTime = RunTime;
|
||||||
|
|
||||||
Sync.CheckSyncUnchanged(world, () => world.TickRender(worldRenderer));
|
Sync.CheckSyncUnchanged(world, () => world.TickRender(worldRenderer));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
PerfHistory.Tick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ namespace OpenRA
|
|||||||
public event Action<Actor> ActorAdded = _ => { };
|
public event Action<Actor> ActorAdded = _ => { };
|
||||||
public event Action<Actor> ActorRemoved = _ => { };
|
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 Paused { get; internal set; }
|
||||||
public bool PredictedPaused { get; internal set; }
|
public bool PredictedPaused { get; internal set; }
|
||||||
public bool PauseStateLocked { get; set; }
|
public bool PauseStateLocked { get; set; }
|
||||||
@@ -284,7 +285,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
if (!Paused && (Type != WorldType.Shellmap || Game.Settings.Game.ShowShellmap))
|
if (!Paused)
|
||||||
{
|
{
|
||||||
WorldTick++;
|
WorldTick++;
|
||||||
|
|
||||||
|
|||||||
@@ -37,14 +37,6 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
Action onComplete;
|
Action onComplete;
|
||||||
|
|
||||||
readonly World world;
|
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
|
||||||
public VqaPlayerWidget(World world)
|
|
||||||
{
|
|
||||||
this.world = world;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Load(string filename)
|
public void Load(string filename)
|
||||||
{
|
{
|
||||||
if (filename == cachedVideo)
|
if (filename == cachedVideo)
|
||||||
@@ -201,7 +193,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
Game.Sound.StopVideo();
|
Game.Sound.StopVideo();
|
||||||
video.Reset();
|
video.Reset();
|
||||||
videoSprite.Sheet.GetTexture().SetData(video.FrameData);
|
videoSprite.Sheet.GetTexture().SetData(video.FrameData);
|
||||||
world.AddFrameEndTask(_ => onComplete());
|
Game.RunAfterTick(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseVideo()
|
public void CloseVideo()
|
||||||
|
|||||||
Reference in New Issue
Block a user