Skip to content

Commit

Permalink
Reformat code.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Dec 10, 2015
1 parent 98cc544 commit 76becc0
Show file tree
Hide file tree
Showing 19 changed files with 1,215 additions and 1,299 deletions.
104 changes: 51 additions & 53 deletions src/xrAICore/Navigation/a_star.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
////////////////////////////////////////////////////////////////////////////
// Module : a_star.h
// Created : 21.03.2002
// Modified : 02.03.2004
// Author : Dmitriy Iassenev
// Description : Implementation of the A* (a-star) algorithm
// Module : a_star.h
// Created : 21.03.2002
// Modified : 02.03.2004
// Author : Dmitriy Iassenev
// Description : Implementation of the A* (a-star) algorithm
////////////////////////////////////////////////////////////////////////////

#pragma once
Expand All @@ -12,68 +12,66 @@
#include "xrAICore/Navigation/data_storage_constructor.h"
#include "xrAICore/Navigation/dijkstra.h"

template<typename _dist_type, typename TVertexData>
template <typename TDistance, typename TVertexData>
struct AStarVertexData
{
template<typename TCompoundVertex>
struct VertexData : TVertexData::template VertexData<TCompoundVertex>
template <typename TCompoundVertex>
struct VertexData : TVertexData::template VertexData<TCompoundVertex>
{
typedef _dist_type _dist_type;
using Distance = TDistance;

_dist_type _g;
_dist_type _h;
Distance _g;
Distance _h;

_dist_type &g() { return _g; }
_dist_type &h() { return _h; }
};
Distance &g() { return _g; }
Distance &h() { return _h; }
};
};

template <
typename _dist_type,
typename _priority_queue,
typename _vertex_manager,
typename _vertex_allocator,
bool euclidian_heuristics = true,
typename _data_storage_base = CVertexPath<euclidian_heuristics>,
typename _iteration_type = u32,
typename TDistance,
typename TPriorityQueue,
typename TVertexManager,
typename TVertexAllocator,
bool EuclidianHeuristics = true,
typename TPathBuilder = CVertexPath<EuclidianHeuristics>,
typename TIteration = u32,
typename TVertexData = EmptyVertexData
> class CAStar : public CDijkstra<
_dist_type,
_priority_queue,
_vertex_manager,
_vertex_allocator,
euclidian_heuristics,
_data_storage_base,
_iteration_type,
AStarVertexData<_dist_type, TVertexData>
>
>
class CAStar : public CDijkstra<
TDistance,
TPriorityQueue,
TVertexManager,
TVertexAllocator,
EuclidianHeuristics,
TPathBuilder,
TIteration,
AStarVertexData<TDistance, TVertexData>
>
{
protected:
typedef CDijkstra <
_dist_type,
_priority_queue,
_vertex_manager,
_vertex_allocator,
euclidian_heuristics,
_data_storage_base,
_iteration_type,
AStarVertexData<_dist_type, TVertexData>
> inherited;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_dist_type _dist_type;
typedef typename CGraphVertex::_index_type _index_type;
using Inherited = CDijkstra<
TDistance,
TPriorityQueue,
TVertexManager,
TVertexAllocator,
EuclidianHeuristics,
TPathBuilder,
TIteration,
AStarVertexData<TDistance, TVertexData>
>;

protected:
template <typename _PathManager>
IC void initialize (_PathManager &path_manager);
template <typename _PathManager>
IC bool step (_PathManager &path_manager);
template <typename TPathManager>
inline void initialize(TPathManager &path_manager);
template <typename TPathManager>
inline bool step(TPathManager &path_manager);

public:
IC CAStar (const u32 max_vertex_count);
virtual ~CAStar ();
template <typename _PathManager>
IC bool find (_PathManager &path_manager);
inline CAStar(const u32 max_vertex_count);
virtual ~CAStar();
template <typename TPathManager>
inline bool find(TPathManager &path_manager);
};

#include "xrAICore/Navigation/a_star_inline.h"
#include "xrAICore/Navigation/a_star_inline.h"
Loading

0 comments on commit 76becc0

Please sign in to comment.