Пример #1
0
        public void CheckIntegrity()
        {
            //make sure im still a good parent

            if (NodeCount >= 2)
            {
                var Visited = new sVisited();
                Visited.Visited = new bool[NodeCount];
                var A = 0;
                FloodCheckInternal(Nodes[0], ref Visited);
                for (A = 0; A <= NodeCount - 1; A++)
                {
                    if (!Visited.Visited[A])
                    {
                        goto DisbandAndFind;
                    }
                }
            }

            if (NodeCount == 1 & ConnectionCount == 0)
            {
                goto DisbandAndFind;
            }
            if (NodeCount > 1)
            {
                SpanCalc();
            }
            else if (NodeCount == 0)
            {
                if (ParentNode != null)
                {
                    var tmpNode = ParentNode;
                    tmpNode.Node_Remove(ParentNode_NodeNum);
                    tmpNode.CheckIntegrity();
                }
                if (Layer.Network_LayerNum > 0)
                {
                    Deallocate();
                }
            }

            return;

DisbandAndFind:
            var B = 0;
            var Children = new PathfinderNode[NodeCount];

            for (B = 0; B <= NodeCount - 1; B++)
            {
                Children[B] = Nodes[B];
            }
            var ChildCount = NodeCount;

            Disband();

            for (B = 0; B <= ChildCount - 1; B++)
            {
                Children[B].Layer.Network.FindParentNode_Add(Children[B]);
            }
        }
Пример #2
0
        public void FloodCheckInternal(PathfinderNode CurrentNode, ref sVisited Visited)
        {
            var A             = 0;
            var tmpNode       = default(PathfinderNode);
            var tmpConnection = default(PathfinderConnection);

            Visited.Visited[CurrentNode.ParentNode_NodeNum] = true;

            for (A = 0; A <= CurrentNode.ConnectionCount - 1; A++)
            {
                tmpConnection = CurrentNode.Connections[A];
                tmpNode       = tmpConnection.GetOtherNode(CurrentNode);
                if (tmpNode.ParentNode == this)
                {
                    if (!Visited.Visited[tmpNode.ParentNode_NodeNum])
                    {
                        FloodCheckInternal(tmpNode, ref Visited);
                    }
                }
            }
        }
Пример #3
0
        public void FloodCheckInternal(PathfinderNode CurrentNode, ref sVisited Visited)
        {
            int A = 0;
            PathfinderNode tmpNode = default(PathfinderNode);
            PathfinderConnection tmpConnection = default(PathfinderConnection);

            Visited.Visited[CurrentNode.ParentNode_NodeNum] = true;

            for ( A = 0; A <= CurrentNode.ConnectionCount - 1; A++ )
            {
                tmpConnection = CurrentNode.Connections[A];
                tmpNode = tmpConnection.GetOtherNode(CurrentNode);
                if ( tmpNode.ParentNode == this )
                {
                    if ( !Visited.Visited[tmpNode.ParentNode_NodeNum] )
                    {
                        FloodCheckInternal(tmpNode, ref Visited);
                    }
                }
            }
        }
Пример #4
0
 public void FloodCheckInternal(PathfinderNode CurrentNode, ref sVisited Visited)
 {
     Visited.Visited[CurrentNode.ParentNode_NodeNum] = true;
     int num2 = CurrentNode.ConnectionCount - 1;
     for (int i = 0; i <= num2; i++)
     {
         PathfinderNode otherNode = CurrentNode.Connections[i].GetOtherNode(CurrentNode);
         if ((otherNode.ParentNode == this) && !Visited.Visited[otherNode.ParentNode_NodeNum])
         {
             this.FloodCheckInternal(otherNode, ref Visited);
         }
     }
 }
Пример #5
0
        public void CheckIntegrity()
        {
            //make sure im still a good parent

            if ( NodeCount >= 2 )
            {
                sVisited Visited = new sVisited();
                Visited.Visited = new bool[NodeCount];
                int A = 0;
                FloodCheckInternal(Nodes[0], ref Visited);
                for ( A = 0; A <= NodeCount - 1; A++ )
                {
                    if ( !Visited.Visited[A] )
                    {
                        goto DisbandAndFind;
                    }
                }
            }

            if ( NodeCount == 1 & ConnectionCount == 0 )
            {
                goto DisbandAndFind;
            }
            else if ( NodeCount > 1 )
            {
                SpanCalc();
            }
            else if ( NodeCount == 0 )
            {
                if ( ParentNode != null )
                {
                    PathfinderNode tmpNode = ParentNode;
                    tmpNode.Node_Remove(ParentNode_NodeNum);
                    tmpNode.CheckIntegrity();
                }
                if ( Layer.Network_LayerNum > 0 )
                {
                    Deallocate();
                }
            }

            return;
            DisbandAndFind:
            int B = 0;
            PathfinderNode[] Children = new PathfinderNode[NodeCount];
            for ( B = 0; B <= NodeCount - 1; B++ )
            {
                Children[B] = Nodes[B];
            }
            int ChildCount = NodeCount;

            Disband();

            for ( B = 0; B <= ChildCount - 1; B++ )
            {
                Children[B].Layer.Network.FindParentNode_Add(Children[B]);
            }
        }