Skip to content

Commit 76becc0

Browse files
author
nitrocaster
committed
Reformat code.
1 parent 98cc544 commit 76becc0

19 files changed

+1215
-1299
lines changed

src/xrAICore/Navigation/a_star.h

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
////////////////////////////////////////////////////////////////////////////
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
77
////////////////////////////////////////////////////////////////////////////
88

99
#pragma once
@@ -12,68 +12,66 @@
1212
#include "xrAICore/Navigation/data_storage_constructor.h"
1313
#include "xrAICore/Navigation/dijkstra.h"
1414

15-
template<typename _dist_type, typename TVertexData>
15+
template <typename TDistance, typename TVertexData>
1616
struct AStarVertexData
1717
{
18-
template<typename TCompoundVertex>
19-
struct VertexData : TVertexData::template VertexData<TCompoundVertex>
18+
template <typename TCompoundVertex>
19+
struct VertexData : TVertexData::template VertexData<TCompoundVertex>
2020
{
21-
typedef _dist_type _dist_type;
21+
using Distance = TDistance;
2222

23-
_dist_type _g;
24-
_dist_type _h;
23+
Distance _g;
24+
Distance _h;
2525

26-
_dist_type &g() { return _g; }
27-
_dist_type &h() { return _h; }
28-
};
26+
Distance &g() { return _g; }
27+
Distance &h() { return _h; }
28+
};
2929
};
3030

3131
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,
3939
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+
>
5051
{
5152
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+
>;
6563

6664
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);
7169

7270
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);
7775
};
7876

79-
#include "xrAICore/Navigation/a_star_inline.h"
77+
#include "xrAICore/Navigation/a_star_inline.h"

0 commit comments

Comments
 (0)