canHoldCurrentProgram() public method

public canHoldCurrentProgram ( Haxxit program ) : bool
program Haxxit
return bool
Example #1
0
 // Non-recursive helper function for AStar algorithm.  Implemented to prevent code duplication for each direction above.
 private void AStarHelp(AINodeData currentNode, AINodeData checkNode, List<AINodeData> openList, List<AINodeData> closeList, Haxxit.Maps.ProgramHeadNode program, Haxxit.Maps.Point destination)
 {
     AINodeData.AStarStatus checkNodeStatus = checkNode.AStarTrackStatus;
     if (checkNodeStatus != AINodeData.AStarStatus.Closed && checkNode.canHoldCurrentProgram(program))
     {
         if (checkNodeStatus == AINodeData.AStarStatus.Unlisted)
         {
             openList.Add(checkNode);
             checkNode.Parent = currentNode;
             checkNode.AStarTrackStatus = AINodeData.AStarStatus.Open;
             checkNode.G = currentNode.G + 1;
             checkNode.H = Math.Abs(destination.X - checkNode.Coordinate.X) + Math.Abs(destination.Y - checkNode.Coordinate.Y);
             checkNode.F = checkNode.G + checkNode.H;
         }
         else
         {
             int checkG = currentNode.G + 1;
             if (checkG < checkNode.G)
             {
                 checkNode.Parent = currentNode;
                 checkNode.G = checkG;
                 checkNode.F = checkNode.G + checkNode.H;
             }
         }
     }
 }