コード例 #1
0
 private MapLinkAStar.AsNode Pop()
 {
     MapLinkAStar.AsNode  data   = this.m_rStack.data;
     MapLinkAStar.AsStack rStack = this.m_rStack;
     this.m_rStack = rStack.next;
     return(data);
 }
コード例 #2
0
    private void UpdateParents(MapLinkAStar.AsNode node)
    {
        int g = node.g;

        for (MapLinkAStar.AsStack asStack = node.child; asStack != null; asStack = asStack.next)
        {
            MapLinkAStar.AsNode data = asStack.data;
            if (g + 1 < data.g)
            {
                data.g      = g + 1;
                data.f      = data.g + data.h;
                data.parent = node;
                this.Push(data);
            }
        }
        while (this.m_rStack != null)
        {
            MapLinkAStar.AsNode asNode = this.Pop();
            for (MapLinkAStar.AsStack asStack = asNode.child; asStack != null; asStack = asStack.next)
            {
                MapLinkAStar.AsNode data = asStack.data;
                if (asNode.g + 1 < data.g)
                {
                    data.g      = asNode.g + 1;
                    data.f      = data.g + data.h;
                    data.parent = asNode;
                    this.Push(data);
                }
            }
        }
    }
コード例 #3
0
 public void DeleteChildAll()
 {
     while (this.child != null)
     {
         MapLinkAStar.AsStack asStack = this.child;
         this.child = asStack.next;
     }
 }
コード例 #4
0
 public void AddChild(ref MapLinkAStar.AsNode node)
 {
     this.child = new MapLinkAStar.AsStack
     {
         data = node,
         next = this.child
     };
 }
コード例 #5
0
 private void Push(MapLinkAStar.AsNode node)
 {
     if (this.m_rStack != null)
     {
         this.m_rStack      = new MapLinkAStar.AsStack();
         this.m_rStack.data = node;
         this.m_rStack.next = null;
     }
     else
     {
         this.m_rStack = new MapLinkAStar.AsStack
         {
             data = node,
             next = this.m_rStack
         };
     }
 }