diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index ee7dfe0a83..bd88e479cd 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -19,6 +19,7 @@ #endregion using System; +using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; @@ -31,7 +32,6 @@ using OpenRA.Network; using OpenRA.Support; using OpenRA.Traits; using Timer = OpenRA.Support.Timer; -using System.Collections.Generic; namespace OpenRA { @@ -144,6 +144,7 @@ namespace OpenRA PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["batches"].hasNormalTick = false; PerfHistory.items["text"].hasNormalTick = false; + PerfHistory.items["cursor"].hasNormalTick = false; Game.controller = controller; ChangeMap(mapName); @@ -223,6 +224,7 @@ namespace OpenRA PerfHistory.items["render"].Tick(); PerfHistory.items["batches"].Tick(); PerfHistory.items["text"].Tick(); + PerfHistory.items["cursor"].Tick(); } public static void SyncLobbyInfo(string data) diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index b3252348b5..f9c6612700 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Traits; +using OpenRA.Support; namespace OpenRA.Orders { @@ -52,15 +53,18 @@ namespace OpenRA.Orders string ChooseCursor( World world, MouseInput mi ) { - var p = Game.controller.MousePosition; - var c = Order(world, p.ToInt2(), mi) - .Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation)) - .FirstOrDefault(a => a != null); + using (new PerfSample("cursor")) + { + var p = Game.controller.MousePosition; + var c = Order(world, p.ToInt2(), mi) + .Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation)) + .FirstOrDefault(a => a != null); - return c ?? - (world.SelectActorsInBox(Game.CellSize * p, - Game.CellSize * p).Any() - ? "select" : "default"); + return c ?? + (world.SelectActorsInBox(Game.CellSize * p, + Game.CellSize * p).Any() + ? "select" : "default"); + } } string CursorForOrderString(string s, Actor a, int2 location)