Debian Codegraph @

DetourCrowd/Include/DetourPathQueue.h

raw symbols SCIP
1 //
2 // Copyright (c) 2009-2010 Mikko Mononen [email protected]
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 // Permission is granted to anyone to use this software for any purpose,
8 // including commercial applications, and to alter it and redistribute it
9 // freely, subject to the following restrictions:
10 // 1. The origin of this software must not be misrepresented; you must not
11 // claim that you wrote the original software. If you use this software
12 // in a product, an acknowledgment in the product documentation would be
13 // appreciated but is not required.
14 // 2. Altered source versions must be plainly marked as such, and must not be
15 // misrepresented as being the original software.
16 // 3. This notice may not be removed or altered from any source distribution.
17 //
18
19 #ifndef DETOURPATHQUEUE_H
20 #define DETOURPATHQUEUE_H
21
22 #include "DetourNavMesh.h"
23 #include "DetourNavMeshQuery.h"
24
25 static const unsigned int DT_PATHQ_INVALID = 0;
26
27 typedef unsigned int dtPathQueueRef;
28
29 class dtPathQueue
30 {
31 struct PathQuery
32 {
33 dtPathQueueRef ref;
34 /// Path find start and end location.
35 float startPos[3], endPos[3];
36 dtPolyRef startRef, endRef;
37 /// Result.
38 dtPolyRef* path;
39 int npath;
40 /// State.
41 dtStatus status;
42 int keepAlive;
43 const dtQueryFilter* filter; ///< TODO: This is potentially dangerous!
44 };
45
46 static const int MAX_QUEUE = 8;
47 PathQuery m_queue[MAX_QUEUE];
48 dtPathQueueRef m_nextHandle;
49 int m_maxPathSize;
50 int m_queueHead;
51 dtNavMeshQuery* m_navquery;
52
53 void purge();
54
55 public:
56 dtPathQueue();
57 ~dtPathQueue();
58
59 bool init(const int maxPathSize, const int maxSearchNodeCount, dtNavMesh* nav);
60
61 void update(const int maxIters);
62
63 dtPathQueueRef request(dtPolyRef startRef, dtPolyRef endRef,
64 const float* startPos, const float* endPos,
65 const dtQueryFilter* filter);
66
67 dtStatus getRequestStatus(dtPathQueueRef ref) const;
68
69 dtStatus getPathResult(dtPathQueueRef ref, dtPolyRef* path, int* pathSize, const int maxPath);
70
71 inline const dtNavMeshQuery* getNavQuery() const { return m_navquery; }
72
73 private:
74 // Explicitly disabled copy constructor and copy assignment operator.
75 dtPathQueue(const dtPathQueue&);
76 dtPathQueue& operator=(const dtPathQueue&);
77 };
78
79 #endif // DETOURPATHQUEUE_H