1
1
// //////////////////////////////////////////////////////////////////////////
2
- // Module : a_star.h
3
- // Created : 21.03.2002
4
- // Modified : 02.03.2004
5
- // Author : Dmitriy Iassenev
6
- // Description : Implementation of the A* (a-star) algorithm
2
+ // Module : a_star.h
3
+ // Created : 21.03.2002
4
+ // Modified : 02.03.2004
5
+ // Author : Dmitriy Iassenev
6
+ // Description : Implementation of the A* (a-star) algorithm
7
7
// //////////////////////////////////////////////////////////////////////////
8
8
9
9
#pragma once
12
12
#include " xrAICore/Navigation/data_storage_constructor.h"
13
13
#include " xrAICore/Navigation/dijkstra.h"
14
14
15
- template <typename _dist_type , typename TVertexData>
15
+ template <typename TDistance , typename TVertexData>
16
16
struct AStarVertexData
17
17
{
18
- template <typename TCompoundVertex>
19
- struct VertexData : TVertexData::template VertexData<TCompoundVertex>
18
+ template <typename TCompoundVertex>
19
+ struct VertexData : TVertexData::template VertexData<TCompoundVertex>
20
20
{
21
- typedef _dist_type _dist_type ;
21
+ using Distance = TDistance ;
22
22
23
- _dist_type _g;
24
- _dist_type _h;
23
+ Distance _g;
24
+ Distance _h;
25
25
26
- _dist_type &g () { return _g; }
27
- _dist_type &h () { return _h; }
28
- };
26
+ Distance &g () { return _g; }
27
+ Distance &h () { return _h; }
28
+ };
29
29
};
30
30
31
31
template <
32
- typename _dist_type ,
33
- typename _priority_queue,
34
- typename _vertex_manager,
35
- typename _vertex_allocator ,
36
- bool euclidian_heuristics = true ,
37
- typename _data_storage_base = CVertexPath<euclidian_heuristics >,
38
- typename _iteration_type = u32 ,
32
+ typename TDistance ,
33
+ typename TPriorityQueue,
34
+ typename TVertexManager,
35
+ typename TVertexAllocator ,
36
+ bool EuclidianHeuristics = true ,
37
+ typename TPathBuilder = CVertexPath<EuclidianHeuristics >,
38
+ typename TIteration = u32 ,
39
39
typename TVertexData = EmptyVertexData
40
- > class CAStar : public CDijkstra <
41
- _dist_type,
42
- _priority_queue,
43
- _vertex_manager,
44
- _vertex_allocator,
45
- euclidian_heuristics,
46
- _data_storage_base,
47
- _iteration_type,
48
- AStarVertexData<_dist_type, TVertexData>
49
- >
40
+ >
41
+ class CAStar : public CDijkstra <
42
+ TDistance,
43
+ TPriorityQueue,
44
+ TVertexManager,
45
+ TVertexAllocator,
46
+ EuclidianHeuristics,
47
+ TPathBuilder,
48
+ TIteration,
49
+ AStarVertexData<TDistance, TVertexData>
50
+ >
50
51
{
51
52
protected:
52
- typedef CDijkstra <
53
- _dist_type,
54
- _priority_queue,
55
- _vertex_manager,
56
- _vertex_allocator,
57
- euclidian_heuristics,
58
- _data_storage_base,
59
- _iteration_type,
60
- AStarVertexData<_dist_type, TVertexData>
61
- > inherited;
62
- typedef typename inherited::CGraphVertex CGraphVertex;
63
- typedef typename CGraphVertex::_dist_type _dist_type;
64
- typedef typename CGraphVertex::_index_type _index_type;
53
+ using Inherited = CDijkstra<
54
+ TDistance,
55
+ TPriorityQueue,
56
+ TVertexManager,
57
+ TVertexAllocator,
58
+ EuclidianHeuristics,
59
+ TPathBuilder,
60
+ TIteration,
61
+ AStarVertexData<TDistance, TVertexData>
62
+ >;
65
63
66
64
protected:
67
- template <typename _PathManager >
68
- IC void initialize (_PathManager &path_manager);
69
- template <typename _PathManager >
70
- IC bool step (_PathManager &path_manager);
65
+ template <typename TPathManager >
66
+ inline void initialize (TPathManager &path_manager);
67
+ template <typename TPathManager >
68
+ inline bool step (TPathManager &path_manager);
71
69
72
70
public:
73
- IC CAStar (const u32 max_vertex_count);
74
- virtual ~CAStar ();
75
- template <typename _PathManager >
76
- IC bool find (_PathManager &path_manager);
71
+ inline CAStar (const u32 max_vertex_count);
72
+ virtual ~CAStar ();
73
+ template <typename TPathManager >
74
+ inline bool find (TPathManager &path_manager);
77
75
};
78
76
79
- #include " xrAICore/Navigation/a_star_inline.h"
77
+ #include " xrAICore/Navigation/a_star_inline.h"
0 commit comments