diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 1ba63077b9..481d5a5741 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -530,7 +530,6 @@ - diff --git a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs index b26d88b23d..6452a1bebb 100644 --- a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs +++ b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs @@ -27,8 +27,6 @@ namespace OpenRA.Mods.Common.Pathfinder /// IEnumerable> Considered { get; } - bool Debug { get; set; } - Player Owner { get; } int MaxCost { get; } @@ -86,7 +84,6 @@ namespace OpenRA.Mods.Common.Pathfinder Graph = graph; OpenQueue = new PriorityQueue(GraphConnection.ConnectionCostComparer); StartPoints = new PriorityQueue(GraphConnection.ConnectionCostComparer); - Debug = false; MaxCost = 0; } diff --git a/OpenRA.Mods.Common/Traits/World/PathFinder.cs b/OpenRA.Mods.Common/Traits/World/PathFinder.cs index 0d28f2ea3f..25fdf42cca 100644 --- a/OpenRA.Mods.Common/Traits/World/PathFinder.cs +++ b/OpenRA.Mods.Common/Traits/World/PathFinder.cs @@ -115,10 +115,6 @@ namespace OpenRA.Mods.Common.Traits public List FindPath(IPathSearch search) { - var dbg = world.WorldActor.TraitOrDefault(); - if (dbg != null && dbg.Visible) - search.Debug = true; - List path = null; while (search.CanExpand) @@ -131,9 +127,6 @@ namespace OpenRA.Mods.Common.Traits } } - if (dbg != null && dbg.Visible) - dbg.AddLayer(search.Considered, search.MaxCost, search.Owner); - search.Graph.Dispose(); if (path != null) @@ -149,13 +142,6 @@ namespace OpenRA.Mods.Common.Traits { List path = null; - var dbg = world.WorldActor.TraitOrDefault(); - if (dbg != null && dbg.Visible) - { - fromSrc.Debug = true; - fromDest.Debug = true; - } - while (fromSrc.CanExpand && fromDest.CanExpand) { // make some progress on the first search @@ -179,12 +165,6 @@ namespace OpenRA.Mods.Common.Traits } } - if (dbg != null && dbg.Visible) - { - dbg.AddLayer(fromSrc.Considered, fromSrc.MaxCost, fromSrc.Owner); - dbg.AddLayer(fromDest.Considered, fromDest.MaxCost, fromDest.Owner); - } - fromSrc.Graph.Dispose(); fromDest.Graph.Dispose(); diff --git a/OpenRA.Mods.Common/Traits/World/PathfinderDebugOverlay.cs b/OpenRA.Mods.Common/Traits/World/PathfinderDebugOverlay.cs deleted file mode 100644 index 0314e18136..0000000000 --- a/OpenRA.Mods.Common/Traits/World/PathfinderDebugOverlay.cs +++ /dev/null @@ -1,89 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.Drawing; -using OpenRA.Graphics; -using OpenRA.Primitives; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.Traits -{ - [Desc("Required for the A* PathDebug from DeveloperMode. Attach this to the world actor.")] - public class PathfinderDebugOverlayInfo : TraitInfo { } - public class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded - { - Dictionary> layers; - int refreshTick; - World world; - public bool Visible; - - public void WorldLoaded(World w, WorldRenderer wr) - { - world = w; - refreshTick = 0; - layers = new Dictionary>(8); - - // Enabled via Cheats menu - Visible = false; - } - - public void AddLayer(IEnumerable> cellWeights, int maxWeight, Player pl) - { - if (maxWeight == 0) return; - - CellLayer layer; - if (!layers.TryGetValue(pl, out layer)) - { - layer = new CellLayer(world.Map); - layers.Add(pl, layer); - } - - foreach (var p in cellWeights) - layer[p.First] = Math.Min(128, layer[p.First] + (maxWeight - p.Second) * 64 / maxWeight); - } - - public void Render(WorldRenderer wr) - { - if (!Visible) - return; - - var qr = Game.Renderer.WorldRgbaColorRenderer; - var doDim = refreshTick - world.WorldTick <= 0; - if (doDim) refreshTick = world.WorldTick + 20; - - var map = wr.World.Map; - foreach (var pair in layers) - { - var c = (pair.Key != null) ? pair.Key.Color.RGB : Color.PaleTurquoise; - var layer = pair.Value; - - // Only render quads in viewing range: - foreach (var uv in wr.Viewport.VisibleCellsInsideBounds.CandidateMapCoords) - { - if (layer[uv] <= 0) - continue; - - var w = Math.Max(0, Math.Min(layer[uv], 128)); - if (doDim) - layer[uv] = layer[uv] * 5 / 6; - - // TODO: This doesn't make sense for isometric terrain - var pos = wr.World.Map.CenterOfCell(uv.ToCPos(map)); - var tl = wr.ScreenPxPosition(pos - new WVec(512, 512, 0)); - var br = wr.ScreenPxPosition(pos + new WVec(511, 511, 0)); - qr.FillRect(tl, br, Color.FromArgb(w, c)); - } - } - } - } -} diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 0a54f842b0..97d2b4c6e3 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -338,6 +338,12 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + if (engineVersion < 20160826 && depth == 0) + { + // Removed debug visualization + node.Value.Nodes.RemoveAll(n => n.Key == "PathfinderDebugOverlay"); + } + UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs index 0498b5fe70..765feef322 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/DebugMenuLogic.cs @@ -120,14 +120,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic noexplorationButton.OnClick = () => world.IssueOrder(new Order("DevResetExploration", world.LocalPlayer.PlayerActor, false)); - var dbgOverlay = world.WorldActor.TraitOrDefault(); - var showAstarCostCheckbox = widget.GetOrNull("SHOW_ASTAR"); - if (showAstarCostCheckbox != null) - { - showAstarCostCheckbox.IsChecked = () => dbgOverlay != null ? dbgOverlay.Visible : false; - showAstarCostCheckbox.OnClick = () => { if (dbgOverlay != null) dbgOverlay.Visible ^= true; }; - } - var showActorTagsCheckbox = widget.GetOrNull("SHOW_ACTOR_TAGS"); if (showActorTagsCheckbox != null) { diff --git a/mods/cnc/chrome/ingame-debug.yaml b/mods/cnc/chrome/ingame-debug.yaml index e7885236c0..0f554222e7 100644 --- a/mods/cnc/chrome/ingame-debug.yaml +++ b/mods/cnc/chrome/ingame-debug.yaml @@ -88,13 +88,13 @@ Container@DEBUG_PANEL: Height: 20 Font: Regular Text: Show Unit Paths - Checkbox@SHOW_ASTAR: + Checkbox@SHOW_CUSTOMTERRAIN_OVERLAY: X: 45 Y: 305 Height: 20 Width: 200 Font: Regular - Text: Show A* Cost + Text: Show Custom Terrain Checkbox@SHOW_COMBATOVERLAY: X: 290 Y: 275 @@ -123,10 +123,3 @@ Container@DEBUG_PANEL: Width: 200 Font: Regular Text: Show Actor Tags - Checkbox@SHOW_CUSTOMTERRAIN_OVERLAY: - X: 290 - Y: 365 - Height: 20 - Width: 200 - Font: Regular - Text: Show Custom Terrain diff --git a/mods/cnc/rules/world.yaml b/mods/cnc/rules/world.yaml index 11bd49f3e2..34a52e37ee 100644 --- a/mods/cnc/rules/world.yaml +++ b/mods/cnc/rules/world.yaml @@ -70,7 +70,6 @@ World: Sequence: craters ResourceLayer: ResourceClaimLayer: - PathfinderDebugOverlay: WarheadDebugOverlay: CustomTerrainDebugOverlay: MapCreeps: diff --git a/mods/d2k/rules/world.yaml b/mods/d2k/rules/world.yaml index 190c715e4e..779f0cfdf4 100644 --- a/mods/d2k/rules/world.yaml +++ b/mods/d2k/rules/world.yaml @@ -74,7 +74,6 @@ World: ValidGround: Sand, Dune, Rock, SpiceSand InitialSpawnDelay: 1500 DomainIndex: - PathfinderDebugOverlay: WarheadDebugOverlay: BuildableTerrainLayer: D2kResourceLayer: diff --git a/mods/ra/chrome/ingame-debug.yaml b/mods/ra/chrome/ingame-debug.yaml index 647ca36cf9..7cfbe1c39d 100644 --- a/mods/ra/chrome/ingame-debug.yaml +++ b/mods/ra/chrome/ingame-debug.yaml @@ -93,13 +93,13 @@ Container@DEBUG_PANEL: Height: 20 Font: Regular Text: Show Unit Paths - Checkbox@SHOW_ASTAR: + Checkbox@SHOW_CUSTOMTERRAIN_OVERLAY: X: 45 Y: 305 Height: 20 Width: 200 Font: Regular - Text: Show A* Cost + Text: Show Custom Terrain Checkbox@SHOW_COMBATOVERLAY: X: 290 Y: 275 @@ -128,10 +128,3 @@ Container@DEBUG_PANEL: Width: 200 Font: Regular Text: Show Actor Tags - Checkbox@SHOW_CUSTOMTERRAIN_OVERLAY: - X: 290 - Y: 365 - Height: 20 - Width: 200 - Font: Regular - Text: Show Custom Terrain diff --git a/mods/ra/rules/world.yaml b/mods/ra/rules/world.yaml index 9a4ddb5acf..bb58bbf0ad 100644 --- a/mods/ra/rules/world.yaml +++ b/mods/ra/rules/world.yaml @@ -118,7 +118,6 @@ World: Sequence: craters ResourceLayer: ResourceClaimLayer: - PathfinderDebugOverlay: WarheadDebugOverlay: SpawnMapActors: MapBuildRadius: diff --git a/mods/ts/chrome/ingame-debug.yaml b/mods/ts/chrome/ingame-debug.yaml index 96a2bc5e9c..78c3f3aa87 100644 --- a/mods/ts/chrome/ingame-debug.yaml +++ b/mods/ts/chrome/ingame-debug.yaml @@ -93,13 +93,13 @@ Container@DEBUG_PANEL: Height: 20 Font: Regular Text: Show Unit Paths - Checkbox@SHOW_ASTAR: + Checkbox@SHOW_CUSTOMTERRAIN_OVERLAY: X: 45 Y: 305 Height: 20 Width: 200 Font: Regular - Text: Show A* Cost + Text: Show Custom Terrain Checkbox@SHOW_DEPTH_PREVIEW: X: 45 Y: 335 @@ -135,10 +135,3 @@ Container@DEBUG_PANEL: Width: 200 Font: Regular Text: Show Actor Tags - Checkbox@SHOW_CUSTOMTERRAIN_OVERLAY: - X: 290 - Y: 365 - Height: 20 - Width: 200 - Font: Regular - Text: Show Custom Terrain diff --git a/mods/ts/rules/world.yaml b/mods/ts/rules/world.yaml index a70da76e28..97013fd14c 100644 --- a/mods/ts/rules/world.yaml +++ b/mods/ts/rules/world.yaml @@ -97,7 +97,6 @@ World: ResourceLayer: CustomTerrainDebugOverlay: ResourceClaimLayer: - PathfinderDebugOverlay: WarheadDebugOverlay: MapCreeps: SpawnMapActors: