Skip to content

Commit

Permalink
Format CGraphEngine sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Dec 11, 2015
1 parent 6623674 commit d6af040
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 351 deletions.
92 changes: 37 additions & 55 deletions src/xrAICore/Navigation/graph_engine.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
////////////////////////////////////////////////////////////////////////////
// Module : graph_engine.h
// Created : 21.03.2002
// Modified : 26.11.2003
// Author : Dmitriy Iassenev
// Description : Graph engine
// Module : graph_engine.h
// Created : 21.03.2002
// Modified : 26.11.2003
// Author : Dmitriy Iassenev
// Description : Graph engine
////////////////////////////////////////////////////////////////////////////

#pragma once
Expand All @@ -26,9 +26,7 @@
namespace hash_fixed_vertex_manager
{
inline u32 to_u32(const GraphEngineSpace::CWorldState &other)
{
return other.hash_value();
}
{ return other.hash_value(); }
}

using namespace GraphEngineSpace;
Expand Down Expand Up @@ -56,7 +54,10 @@ class CGraphEngine

#ifndef AI_COMPILER
// solver algorithm
using CSolverPriorityQueue = CDataStorageBinaryHeap;
static const size_t SolverMaxVertexCount = 16*1024;
using CSolverPriorityQueue = CDataStorageBinaryHeap;
// XXX: originally CSolverAlgorithm is constructed with 16*1024 limit
// while the following definitions use 8*1024 limit -- check if that's a mistake
using CSolverVertexManager = CVertexManagerHashFixed<u32, _solver_index_type, 256, 8*1024>;
using CSolverVertexAllocator = CVertexAllocatorFixed<8*1024>;
using SolverAlgorithmStorage = CEdgePath<_solver_edge_type, true>;
Expand All @@ -68,12 +69,13 @@ class CGraphEngine
true,
SolverAlgorithmStorage>;
// string algorithm
static const size_t StringMaxVertexCount = 1024;
using CStringPriorityQueue = CDataStorageBinaryHeap;
using CStringVertexManager = CVertexManagerHashFixed<u32, shared_str, 128, 1024>;
using CStringVertexAllocator = CVertexAllocatorFixed<1024>;
using CStringVertexManager = CVertexManagerHashFixed<u32, shared_str, 128, StringMaxVertexCount>;
using CStringVertexAllocator = CVertexAllocatorFixed<StringMaxVertexCount>;
using StringAlgorithmStorage = AlgorithmStorage;
using StringAlgorithmDistance = float;
using CStringAlgorithm = CAStar<
using CStringAlgorithm = CAStar<
StringAlgorithmDistance,
CStringPriorityQueue,
CStringVertexManager,
Expand All @@ -82,63 +84,43 @@ class CGraphEngine
StringAlgorithmStorage>;
#endif // AI_COMPILER

CAlgorithm *m_algorithm;
CAlgorithm *m_algorithm;

#ifndef AI_COMPILER
CSolverAlgorithm *m_solver_algorithm;
CStringAlgorithm *m_string_algorithm;
CSolverAlgorithm *m_solver_algorithm;
CStringAlgorithm *m_string_algorithm;
#endif
CStatTimer PathTimer;

public:
inline CGraphEngine(u32 max_vertex_count);
virtual ~CGraphEngine();
inline CGraphEngine(u32 max_vertex_count);
virtual ~CGraphEngine();
#ifndef AI_COMPILER
inline const CSolverAlgorithm &solver_algorithm() const;
inline const CSolverAlgorithm &solver_algorithm() const;
#endif

template<typename _Graph, typename _Parameters>
inline bool search(
const _Graph &graph,
const shared_str &start_node,
const shared_str &dest_node,
xr_vector<shared_str> *node_path,
_Parameters &parameters);
template <typename _Graph, typename _Parameters>
inline bool search(const _Graph &graph, const shared_str &start_node, const shared_str &dest_node,
xr_vector<shared_str> *node_path, _Parameters &parameters);

template<typename _Graph, typename _Parameters>
inline bool search(
const _Graph &graph,
const _index_type &start_node,
const _index_type &dest_node,
xr_vector<_index_type> *node_path,
const _Parameters &parameters);
template <typename _Graph, typename _Parameters>
inline bool search(const _Graph &graph, const _index_type &start_node, const _index_type &dest_node,
xr_vector<_index_type> *node_path, const _Parameters &parameters);

template<typename _Graph, typename _Parameters>
inline bool search(
const _Graph &graph,
const _index_type &start_node,
const _index_type &dest_node,
xr_vector<_index_type> *node_path,
_Parameters &parameters);
template <typename _Graph, typename _Parameters>
inline bool search(const _Graph &graph, const _index_type &start_node, const _index_type &dest_node,
xr_vector<_index_type> *node_path, _Parameters &parameters);

template<typename _Graph, typename _Parameters, typename _PathManager>
inline bool search(
const _Graph &graph,
const _index_type &start_node,
const _index_type &dest_node,
xr_vector<_index_type> *node_path,
const _Parameters &parameters,
_PathManager &path_manager);
template<typename _Graph, typename _Parameters, typename _PathManager>
inline bool search(const _Graph &graph, const _index_type &start_node, const _index_type &dest_node,
xr_vector<_index_type> *node_path, const _Parameters &parameters, _PathManager &path_manager);

#ifndef AI_COMPILER
template<typename T1, typename T2, typename T3, typename T4,
typename T5, bool T6, typename T7, typename T8, typename _Parameters>
inline bool search(
const CProblemSolver<T1, T2, T3, T4, T5, T6, T7, T8> &graph,
const _solver_index_type &start_node,
const _solver_index_type &dest_node,
xr_vector<_solver_edge_type> *node_path,
const _Parameters &parameters);
template<typename T1, typename T2, typename T3, typename T4,
typename T5, bool T6, typename T7, typename T8, typename _Parameters>
inline bool search(const CProblemSolver<T1, T2, T3, T4, T5, T6, T7, T8> &graph,
const _solver_index_type &start_node, const _solver_index_type &dest_node,
xr_vector<_solver_edge_type> *node_path, const _Parameters &parameters);
#endif
};

Expand Down
Loading

0 comments on commit d6af040

Please sign in to comment.