diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index bb388ba877..d962758734 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -477,5 +477,10 @@ namespace OpenRA { quit = true; } + + public static void Debug(string s) + { + chat.AddLine(Color.White, "Debug", s); + } } } diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index 27cb39134e..9231fa4557 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -53,7 +53,7 @@ namespace OpenRA.Orders string ChooseCursor(World world, MouseInput mi) { - using (new PerfSample("cursor")) + //using (new PerfSample("cursor")) { var p = Game.controller.MousePosition; var c = Order(world, p.ToInt2(), mi) diff --git a/OpenRA.Game/PathFinder.cs b/OpenRA.Game/PathFinder.cs index b08eec0768..c21923d63f 100644 --- a/OpenRA.Game/PathFinder.cs +++ b/OpenRA.Game/PathFinder.cs @@ -50,6 +50,8 @@ namespace OpenRA { using (new PerfSample("find_unit_path")) { + Game.Debug("FindUnitPath {0} -> {1}".F(from, target)); + var pb = FindBidiPath( PathSearch.FromPoint(world, target, from, umt, false).WithCustomBlocker(AvoidUnitsNear(from, 4)), PathSearch.FromPoint(world, from, target, umt, false).WithCustomBlocker(AvoidUnitsNear(from, 4))); @@ -61,7 +63,7 @@ namespace OpenRA public List FindUnitPathToRange( int2 src, int2 target, UnitMovementType umt, int range ) { - using( new PerfSample( "find_unit_path_multiple_src" ) ) + //using( new PerfSample( "find_unit_path_multiple_src" ) ) { var tilesInRange = world.FindTilesInCircle(target, range) .Where( t => world.IsPathableCell( t, umt ) ); @@ -82,7 +84,7 @@ namespace OpenRA public List FindPath( PathSearch search ) { - using (new PerfSample("find_path_inner")) + //using (new PerfSample("find_path_inner")) { while (!search.queue.Empty) { diff --git a/OpenRA.Game/Shroud.cs b/OpenRA.Game/Shroud.cs index 455e447b0d..e7bc837f48 100644 --- a/OpenRA.Game/Shroud.cs +++ b/OpenRA.Game/Shroud.cs @@ -25,6 +25,7 @@ using OpenRA.FileFormats; using OpenRA.GameRules; using OpenRA.Graphics; using OpenRA.Traits; +using OpenRA.Support; namespace OpenRA { @@ -112,19 +113,22 @@ namespace OpenRA public void Explore(World w, int2 center, int range) { - if (range == 0) - return; - - var box = MakeRect(center, range); - bounds = bounds.HasValue ? - Rectangle.Union(bounds.Value, box) : box; - - foreach (var t in w.FindTilesInCircle(center, range)) + using (new PerfSample("explore")) { - explored[t.X, t.Y] = true; - gapField[t.X, t.Y] = 0; + if (range == 0) + return; + + var box = MakeRect(center, range); + bounds = bounds.HasValue ? + Rectangle.Union(bounds.Value, box) : box; + + foreach (var t in w.FindTilesInCircle(center, range)) + { + explored[t.X, t.Y] = true; + gapField[t.X, t.Y] = 0; + } + dirty = true; } - dirty = true; } public void Explore(Actor a) diff --git a/OpenRA.Game/Support/PerfHistory.cs b/OpenRA.Game/Support/PerfHistory.cs index 0eb8e86587..94a8dcbed3 100644 --- a/OpenRA.Game/Support/PerfHistory.cs +++ b/OpenRA.Game/Support/PerfHistory.cs @@ -29,7 +29,11 @@ namespace OpenRA.Support { static class PerfHistory { - static readonly Color[] colors = { Color.Red, Color.Green, Color.Blue, Color.Yellow, Color.Orange, Color.Fuchsia, Color.Lime, Color.LightBlue, Color.White, Color.Black }; + static readonly Color[] colors = { Color.Red, Color.Green, + Color.Blue, Color.Yellow, + Color.Orange, Color.Fuchsia, + Color.Lime, Color.LightBlue, + Color.White, Color.Teal }; static int nextColor; public static Cache items = new Cache( diff --git a/OpenRA.Game/Traits/Activities/Move.cs b/OpenRA.Game/Traits/Activities/Move.cs index 2991c327c2..621873347e 100755 --- a/OpenRA.Game/Traits/Activities/Move.cs +++ b/OpenRA.Game/Traits/Activities/Move.cs @@ -64,7 +64,8 @@ namespace OpenRA.Traits.Activities this.getPath = (self, mobile) => self.World.PathFinder.FindPath( PathSearch.FromPoint( self.World, self.Location, destination, mobile.GetMovementType(), false ) - .WithCustomBlocker( self.World.PathFinder.AvoidUnitsNear( self.Location, 4 )).WithIgnoredBuilding( ignoreBuilding )); + .WithCustomBlocker( self.World.PathFinder.AvoidUnitsNear( self.Location, 4 )) + .WithIgnoredBuilding( ignoreBuilding )); this.destination = destination; this.nearEnough = 0; diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 6073a5b962..4a59f05d1c 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -166,7 +166,7 @@ namespace OpenRA public int SyncHash() { - using (new PerfSample("synchash")) + //using (new PerfSample("synchash")) { int ret = 0; foreach (var a in Actors)