Removing orphans in PathFinder.GenerateNodes, fixed autopilot steering the wrong way if clicking an already selected destination tickbox

This commit is contained in:
Regalis
2016-11-15 20:48:52 +02:00
parent 642a1bdd54
commit 184c6858cd
2 changed files with 3 additions and 7 deletions

View File

@@ -61,6 +61,7 @@ namespace Barotrauma
}
var nodeList = nodes.Values.ToList();
nodeList.RemoveAll(n => n.connections.Count == 0);
foreach (PathNode node in nodeList)
{
node.distances = new List<float>();
@@ -69,6 +70,7 @@ namespace Barotrauma
node.distances.Add(Vector2.Distance(node.position, node.connections[i].position));
}
}
return nodeList;
}
}
@@ -198,12 +200,6 @@ namespace Barotrauma
{
Vector2 nodePos = node.Position;
//if node waypoint is one of submarine waypoints outside the sub, transform position
//if (node.Waypoint!=null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull==null)
//{
// nodePos -= node.Waypoint.Submarine.Position;
//}
float dist = Vector2.Distance(end, nodePos);
if (dist < closestDist || endNode == null)
{

View File

@@ -424,10 +424,10 @@ namespace Barotrauma.Items.Components
maintainPosTickBox.Selected = false;
posToMaintain = null;
tickBox.Selected = true;
UpdatePath();
tickBox.Selected = true;
return true;
}