diff options
author | Subv <subv2112@gmail.com> | 2014-07-03 15:57:47 -0500 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2014-07-03 15:57:47 -0500 |
commit | 151785b9ced2d6fa2d6c422fff7c53672c18ba98 (patch) | |
tree | f41249f60a739f408ce226252d375ab04e65c8fd /dep/recastnavigation/Detour/Source/DetourNode.cpp | |
parent | 0a07fd5fc38f5b3beac187de88dcd26cb60d9f76 (diff) | |
parent | 7b74a725c89cca383acab8a002c162fc7ff1e0ac (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into boost
Conflicts:
src/server/game/World/World.cpp
Diffstat (limited to 'dep/recastnavigation/Detour/Source/DetourNode.cpp')
-rw-r--r-- | dep/recastnavigation/Detour/Source/DetourNode.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/dep/recastnavigation/Detour/Source/DetourNode.cpp b/dep/recastnavigation/Detour/Source/DetourNode.cpp index 4c8215e20d0..1d1897708f4 100644 --- a/dep/recastnavigation/Detour/Source/DetourNode.cpp +++ b/dep/recastnavigation/Detour/Source/DetourNode.cpp @@ -71,27 +71,46 @@ void dtNodePool::clear() m_nodeCount = 0; } -dtNode* dtNodePool::findNode(dtPolyRef id) +unsigned int dtNodePool::findNodes(dtPolyRef id, dtNode** nodes, const int maxNodes) { + int n = 0; unsigned int bucket = dtHashRef(id) & (m_hashSize-1); dtNodeIndex i = m_first[bucket]; while (i != DT_NULL_IDX) { if (m_nodes[i].id == id) + { + if (n >= maxNodes) + return n; + nodes[n++] = &m_nodes[i]; + } + i = m_next[i]; + } + + return n; +} + +dtNode* dtNodePool::findNode(dtPolyRef id, unsigned char state) +{ + unsigned int bucket = dtHashRef(id) & (m_hashSize-1); + dtNodeIndex i = m_first[bucket]; + while (i != DT_NULL_IDX) + { + if (m_nodes[i].id == id && m_nodes[i].state == state) return &m_nodes[i]; i = m_next[i]; } return 0; } -dtNode* dtNodePool::getNode(dtPolyRef id) +dtNode* dtNodePool::getNode(dtPolyRef id, unsigned char state) { unsigned int bucket = dtHashRef(id) & (m_hashSize-1); dtNodeIndex i = m_first[bucket]; dtNode* node = 0; while (i != DT_NULL_IDX) { - if (m_nodes[i].id == id) + if (m_nodes[i].id == id && m_nodes[i].state == state) return &m_nodes[i]; i = m_next[i]; } @@ -108,6 +127,7 @@ dtNode* dtNodePool::getNode(dtPolyRef id) node->cost = 0; node->total = 0; node->id = id; + node->state = state; node->flags = 0; m_next[i] = m_first[bucket]; |