Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dtNodePool::dtNodePool(int maxNodes, int hashSize) :
- m_nodes(0),
- m_first(0),
- m_next(0),
- m_maxNodes(maxNodes),
- m_hashSize(hashSize),
- m_nodeCount(0)
- {
- dtAssert(dtNextPow2(m_hashSize) == (unsigned int)m_hashSize);
- // pidx is special as 0 means "none" and 1 is the first node. For that reason
- // we have 1 fewer nodes available than the number of values it can contain.
- dtAssert(m_maxNodes > 0 && m_maxNodes <= DT_NULL_IDX && m_maxNodes <= (1 << DT_NODE_PARENT_BITS) - 1);
- m_nodes = (dtNode*)dtAlloc(sizeof(dtNode)*m_maxNodes, DT_ALLOC_PERM);
- m_next = (dtNodeIndex*)dtAlloc(sizeof(dtNodeIndex)*m_maxNodes, DT_ALLOC_PERM);
- m_first = (dtNodeIndex*)dtAlloc(sizeof(dtNodeIndex)*hashSize, DT_ALLOC_PERM);
- dtAssert(m_nodes); // <= V568 It's odd that 'sizeof()' operator evaluates the size of a pointer to a class, but not the size of the 'm_nodes' class object. detournode.cpp 68
- dtAssert(m_next);
- dtAssert(m_first);
- memset(m_first, 0xff, sizeof(dtNodeIndex)*m_hashSize);
- memset(m_next, 0xff, sizeof(dtNodeIndex)*m_maxNodes);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement