/// <summary> /// Adds a successor to a list if it is not impassible or the parent node /// </summary> /// <param name="ASuccessors">List of successors</param> /// <param name="AX">X-coordinate</param> /// <param name="AY">Y-coordinate</param> void AddSuccessor(ArrayList ASuccessors, int AX, int AY) { int CurrentCost = StartPath.GetMap(AX, AY); if (CurrentCost == -1) { return; } AStarNode2D NewNode = new AStarNode2D(this, GoalNode, Cost + CurrentCost, AX, AY); if (NewNode.IsSameState(Parent)) { return; } ASuccessors.Add(NewNode); }
/// <summary> /// Adds a successor to a list if it is not impassible or the parent node /// </summary> /// <param name="aSuccessors">List of successors</param> /// <param name="aX">X-coordinate</param> /// <param name="aY">Y-coordinate</param> void AddSuccessor(ArrayList aSuccessors, int aX, int aY) { int CurrentCost = StartPath.GetMap(aX, aY); if (CurrentCost == -1) { return; } AStarNode2D NewNode = new AStarNode2D(this, GoalNode, Cost + CurrentCost, aX, aY); if (NewNode.IsSameState(Parent)) { return; } aSuccessors.Add(NewNode); }