IsSameState() public method

Determines whether the current node is the same state as the on passed.
public IsSameState ( AStarNode aNode ) : bool
aNode AStarNode AStarNode to compare the current node to
return bool
        /// <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);
        }
示例#2
0
 /// <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);
 }