dtHashRef() public static method

public static dtHashRef ( System.UInt64 a ) : uint
a System.UInt64
return uint
Ejemplo n.º 1
0
        public dtNode findNode(dtPolyRef id)
        {
            uint        bucket = (uint)(DetourNode.dtHashRef(id) & (m_hashSize - 1));
            dtNodeIndex i      = m_first[bucket];

            while (i != DetourNode.DT_NULL_IDX)
            {
                if (m_nodes[i].id == id)
                {
                    return(m_nodes[i]);
                }
                i = m_next[i];
            }
            return(null);
        }
Ejemplo n.º 2
0
        public List <dtNode> findNodes(dtPolyRef id, int maxNodes)
        {
            List <dtNode> ret = new List <dtNode>();

            uint        bucket = (uint)(DetourNode.dtHashRef(id) & (m_hashSize - 1));
            dtNodeIndex i      = m_first[bucket];

            while (i != DetourNode.DT_NULL_IDX)
            {
                if (m_nodes[i].id == id)
                {
                    if (ret.Count >= maxNodes)
                    {
                        return(ret);
                    }
                    ret.Add(m_nodes[i]);
                }
                i = m_next[i];
            }

            return(ret);
        }
Ejemplo n.º 3
0
        public dtNode getNode(dtPolyRef id, uint state)
        {
            uint        bucket = (uint)(DetourNode.dtHashRef(id) & (m_hashSize - 1));
            dtNodeIndex i      = m_first[bucket];
            dtNode      node   = null;

            while (i != DetourNode.DT_NULL_IDX)
            {
                if (m_nodes[i].id == id && m_nodes[i].state == state)
                {
                    return(m_nodes[i]);
                }
                i = m_next[i];
            }

            if (m_nodeCount >= m_maxNodes)
            {
                return(null);
            }

            i = (dtNodeIndex)m_nodeCount;
            m_nodeCount++;

            node       = m_nodes[i];
            node.pidx  = 0;
            node.cost  = 0;
            node.total = 0;
            node.id    = id;
            node.state = state;
            node.flags = 0;

            m_next[i]       = m_first[bucket];
            m_first[bucket] = i;

            return(node);
        }