Remove legacy A* visualisation.
This commit is contained in:
@@ -530,7 +530,6 @@
|
||||
<Compile Include="Pathfinder\PathFinderUnitPathCacheDecorator.cs" />
|
||||
<Compile Include="Pathfinder\PathCacheStorage.cs" />
|
||||
<Compile Include="Traits\World\PathFinder.cs" />
|
||||
<Compile Include="Traits\World\PathfinderDebugOverlay.cs" />
|
||||
<Compile Include="Pathfinder\PathSearch.cs" />
|
||||
<Compile Include="Pathfinder\BasePathSearch.cs" />
|
||||
<Compile Include="Traits\World\PlayerPaletteFromCurrentTileset.cs" />
|
||||
|
||||
@@ -27,8 +27,6 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
/// </summary>
|
||||
IEnumerable<Pair<CPos, int>> 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>(GraphConnection.ConnectionCostComparer);
|
||||
StartPoints = new PriorityQueue<GraphConnection>(GraphConnection.ConnectionCostComparer);
|
||||
Debug = false;
|
||||
MaxCost = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,10 +115,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public List<CPos> FindPath(IPathSearch search)
|
||||
{
|
||||
var dbg = world.WorldActor.TraitOrDefault<PathfinderDebugOverlay>();
|
||||
if (dbg != null && dbg.Visible)
|
||||
search.Debug = true;
|
||||
|
||||
List<CPos> 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<CPos> path = null;
|
||||
|
||||
var dbg = world.WorldActor.TraitOrDefault<PathfinderDebugOverlay>();
|
||||
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();
|
||||
|
||||
|
||||
@@ -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<PathfinderDebugOverlay> { }
|
||||
public class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded
|
||||
{
|
||||
Dictionary<Player, CellLayer<int>> layers;
|
||||
int refreshTick;
|
||||
World world;
|
||||
public bool Visible;
|
||||
|
||||
public void WorldLoaded(World w, WorldRenderer wr)
|
||||
{
|
||||
world = w;
|
||||
refreshTick = 0;
|
||||
layers = new Dictionary<Player, CellLayer<int>>(8);
|
||||
|
||||
// Enabled via Cheats menu
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public void AddLayer(IEnumerable<Pair<CPos, int>> cellWeights, int maxWeight, Player pl)
|
||||
{
|
||||
if (maxWeight == 0) return;
|
||||
|
||||
CellLayer<int> layer;
|
||||
if (!layers.TryGetValue(pl, out layer))
|
||||
{
|
||||
layer = new CellLayer<int>(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<PathfinderDebugOverlay>();
|
||||
var showAstarCostCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_ASTAR");
|
||||
if (showAstarCostCheckbox != null)
|
||||
{
|
||||
showAstarCostCheckbox.IsChecked = () => dbgOverlay != null ? dbgOverlay.Visible : false;
|
||||
showAstarCostCheckbox.OnClick = () => { if (dbgOverlay != null) dbgOverlay.Visible ^= true; };
|
||||
}
|
||||
|
||||
var showActorTagsCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_ACTOR_TAGS");
|
||||
if (showActorTagsCheckbox != null)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -70,7 +70,6 @@ World:
|
||||
Sequence: craters
|
||||
ResourceLayer:
|
||||
ResourceClaimLayer:
|
||||
PathfinderDebugOverlay:
|
||||
WarheadDebugOverlay:
|
||||
CustomTerrainDebugOverlay:
|
||||
MapCreeps:
|
||||
|
||||
@@ -74,7 +74,6 @@ World:
|
||||
ValidGround: Sand, Dune, Rock, SpiceSand
|
||||
InitialSpawnDelay: 1500
|
||||
DomainIndex:
|
||||
PathfinderDebugOverlay:
|
||||
WarheadDebugOverlay:
|
||||
BuildableTerrainLayer:
|
||||
D2kResourceLayer:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -118,7 +118,6 @@ World:
|
||||
Sequence: craters
|
||||
ResourceLayer:
|
||||
ResourceClaimLayer:
|
||||
PathfinderDebugOverlay:
|
||||
WarheadDebugOverlay:
|
||||
SpawnMapActors:
|
||||
MapBuildRadius:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -97,7 +97,6 @@ World:
|
||||
ResourceLayer:
|
||||
CustomTerrainDebugOverlay:
|
||||
ResourceClaimLayer:
|
||||
PathfinderDebugOverlay:
|
||||
WarheadDebugOverlay:
|
||||
MapCreeps:
|
||||
SpawnMapActors:
|
||||
|
||||
Reference in New Issue
Block a user