From 64f57ac9a5dd7238300d3ead17378cca392f7001 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Wed, 23 Dec 2015 14:07:09 +0100 Subject: [PATCH 1/2] Try to win a small amount of performance when the shellmap is disabled --- OpenRA.Game/Game.cs | 13 +++++++++---- OpenRA.Game/World.cs | 3 ++- OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 61b998c275..0d73fcf379 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -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(); } } } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 4cacd3392d..d2204d5b1d 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -260,6 +260,7 @@ namespace OpenRA public event Action ActorAdded = _ => { }; public event Action 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++; diff --git a/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs b/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs index ecb51c118e..d0c4c1445f 100644 --- a/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs @@ -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() From 76d88e5ae49a1a228b23d1e3065d418cd6106ac0 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Wed, 23 Dec 2015 15:26:51 +0100 Subject: [PATCH 2/2] Remove the now unused ctor of VqaPlayerWidget to silence travis --- OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs b/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs index d0c4c1445f..45be7bae6b 100644 --- a/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/VqaPlayerWidget.cs @@ -37,14 +37,6 @@ namespace OpenRA.Mods.Common.Widgets Action onComplete; - readonly World world; - - [ObjectCreator.UseCtor] - public VqaPlayerWidget(World world) - { - this.world = world; - } - public void Load(string filename) { if (filename == cachedVideo)