aboutsummaryrefslogtreecommitdiff
path: root/dep/recastnavigation/Detour/DetourNode.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-06-18 21:04:31 +0200
committerShauren <shauren.trinity@gmail.com>2013-06-18 21:04:31 +0200
commitf517467817207a75cbe395ec96de2dceb0cac5da (patch)
tree80457050fd0d460565895aba21ba285cbf323f86 /dep/recastnavigation/Detour/DetourNode.cpp
parent3367dd5be93b8e63dce41fe6e303aa8ec41a43db (diff)
parent89ec90753914ae89b2dbbc7a343cd8a667410af3 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'dep/recastnavigation/Detour/DetourNode.cpp')
-rw-r--r--dep/recastnavigation/Detour/DetourNode.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/dep/recastnavigation/Detour/DetourNode.cpp b/dep/recastnavigation/Detour/DetourNode.cpp
index 0d1af837865..4c8215e20d0 100644
--- a/dep/recastnavigation/Detour/DetourNode.cpp
+++ b/dep/recastnavigation/Detour/DetourNode.cpp
@@ -24,6 +24,7 @@
inline unsigned int dtHashRef(dtPolyRef a)
{
+ // Edited by TC
a = (~a) + (a << 18);
a = a ^ (a >> 31);
a = a * 21;
@@ -46,15 +47,15 @@ dtNodePool::dtNodePool(int maxNodes, int hashSize) :
dtAssert(m_maxNodes > 0);
m_nodes = (dtNode*)dtAlloc(sizeof(dtNode)*m_maxNodes, DT_ALLOC_PERM);
- m_next = (unsigned short*)dtAlloc(sizeof(unsigned short)*m_maxNodes, DT_ALLOC_PERM);
- m_first = (unsigned short*)dtAlloc(sizeof(unsigned short)*hashSize, 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);
dtAssert(m_next);
dtAssert(m_first);
- memset(m_first, 0xff, sizeof(unsigned short)*m_hashSize);
- memset(m_next, 0xff, sizeof(unsigned short)*m_maxNodes);
+ memset(m_first, 0xff, sizeof(dtNodeIndex)*m_hashSize);
+ memset(m_next, 0xff, sizeof(dtNodeIndex)*m_maxNodes);
}
dtNodePool::~dtNodePool()
@@ -66,14 +67,14 @@ dtNodePool::~dtNodePool()
void dtNodePool::clear()
{
- memset(m_first, 0xff, sizeof(unsigned short)*m_hashSize);
+ memset(m_first, 0xff, sizeof(dtNodeIndex)*m_hashSize);
m_nodeCount = 0;
}
dtNode* dtNodePool::findNode(dtPolyRef id)
{
unsigned int bucket = dtHashRef(id) & (m_hashSize-1);
- unsigned short i = m_first[bucket];
+ dtNodeIndex i = m_first[bucket];
while (i != DT_NULL_IDX)
{
if (m_nodes[i].id == id)
@@ -86,7 +87,7 @@ dtNode* dtNodePool::findNode(dtPolyRef id)
dtNode* dtNodePool::getNode(dtPolyRef id)
{
unsigned int bucket = dtHashRef(id) & (m_hashSize-1);
- unsigned short i = m_first[bucket];
+ dtNodeIndex i = m_first[bucket];
dtNode* node = 0;
while (i != DT_NULL_IDX)
{
@@ -98,7 +99,7 @@ dtNode* dtNodePool::getNode(dtPolyRef id)
if (m_nodeCount >= m_maxNodes)
return 0;
- i = (unsigned short)m_nodeCount;
+ i = (dtNodeIndex)m_nodeCount;
m_nodeCount++;
// Init node