From cb3c6899649572bce5bcd1fbd617c7949bd96aca Mon Sep 17 00:00:00 2001 From: isoboleskiy Date: Sun, 22 Sep 2024 22:25:03 +0300 Subject: [PATCH] * DEL: path_manager_* remove from exploitation. It doesn't make sense anymore. --- .../LevelEditor/AI/graph_engine_editor.h | 2 +- src/Editors/LevelEditor/AI/path_manager.h | 46 ----- .../LevelEditor/AI/path_manager_game.h | 59 ------- .../LevelEditor/AI/path_manager_game_inline.h | 77 --------- .../LevelEditor/AI/path_manager_game_level.h | 75 -------- .../AI/path_manager_game_level_inline.h | 85 ---------- .../AI/path_manager_game_vertex_type.h | 75 -------- .../AI/path_manager_game_vertex_type_inline.h | 85 ---------- .../LevelEditor/AI/path_manager_generic.h | 55 ------ .../AI/path_manager_generic_inline.h | 160 ------------------ .../LevelEditor/AI/path_manager_level.h | 87 ---------- .../AI/path_manager_level_evaluator.h | 66 -------- .../AI/path_manager_level_evaluator_inline.h | 90 ---------- .../AI/path_manager_level_flooder.h | 79 --------- .../AI/path_manager_level_flooder_inline.h | 113 ------------- .../AI/path_manager_level_inline.h | 141 --------------- .../AI/path_manager_level_straight_line.h | 72 -------- .../path_manager_level_straight_line_inline.h | 111 ------------ .../LevelEditor/AI/path_manager_params.h | 2 +- .../AI/path_manager_params_flooder.h | 39 ----- .../AI/path_manager_params_game_level.h | 51 ------ .../AI/path_manager_params_straight_line.h | 47 ----- src/utils/xrAI/graph_engine.h | 2 +- src/utils/xrAI/path_manager.h | 58 ------- src/utils/xrAI/path_manager_game.h | 59 ------- src/utils/xrAI/path_manager_game_inline.h | 77 --------- src/utils/xrAI/path_manager_game_level.h | 75 -------- .../xrAI/path_manager_game_level_inline.h | 85 ---------- .../xrAI/path_manager_game_vertex_type.h | 75 -------- .../path_manager_game_vertex_type_inline.h | 85 ---------- src/utils/xrAI/path_manager_generic.h | 55 ------ src/utils/xrAI/path_manager_generic_inline.h | 160 ------------------ src/utils/xrAI/path_manager_level.h | 90 ---------- src/utils/xrAI/path_manager_level_evaluator.h | 66 -------- .../path_manager_level_evaluator_inline.h | 90 ---------- src/utils/xrAI/path_manager_level_flooder.h | 79 --------- .../xrAI/path_manager_level_flooder_inline.h | 113 ------------- src/utils/xrAI/path_manager_level_inline.h | 141 --------------- .../xrAI/path_manager_level_straight_line.h | 72 -------- .../path_manager_level_straight_line_inline.h | 111 ------------ src/utils/xrAI/path_manager_params_flooder.h | 39 ----- .../xrAI/path_manager_params_game_level.h | 51 ------ .../xrAI/path_manager_params_straight_line.h | 47 ----- src/xrEngine/AI/graph_engine.h | 1 - src/xrGame/abstract_path_manager_inline.h | 2 +- .../alife_monster_detail_path_manager.cpp | 4 +- src/xrGame/path_manager.h | 57 ------- src/xrGame/path_manager_game.h | 59 ------- src/xrGame/path_manager_game_inline.h | 77 --------- src/xrGame/path_manager_game_level.h | 75 -------- src/xrGame/path_manager_game_level_inline.h | 85 ---------- src/xrGame/path_manager_game_vertex.h | 72 -------- src/xrGame/path_manager_game_vertex_inline.h | 80 --------- src/xrGame/path_manager_generic.h | 55 ------ src/xrGame/path_manager_generic_inline.h | 160 ------------------ src/xrGame/path_manager_level.h | 87 ---------- src/xrGame/path_manager_level_flooder.h | 79 --------- .../path_manager_level_flooder_inline.h | 113 ------------- src/xrGame/path_manager_level_inline.h | 141 --------------- .../path_manager_level_nearest_vertex.h | 81 --------- ...path_manager_level_nearest_vertex_inline.h | 124 -------------- src/xrGame/path_manager_level_straight_line.h | 72 -------- .../path_manager_level_straight_line_inline.h | 111 ------------ src/xrGame/path_manager_params.h | 44 ++++- src/xrGame/path_manager_params_flooder.h | 39 ----- src/xrGame/path_manager_params_game_level.h | 50 ------ src/xrGame/path_manager_params_game_vertex.h | 53 ------ .../path_manager_params_nearest_vertex.h | 43 ----- .../path_manager_params_straight_line.h | 47 ----- src/xrGame/path_manager_solver.h | 68 -------- src/xrGame/path_manager_solver_inline.h | 115 ------------- 71 files changed, 48 insertions(+), 5193 deletions(-) delete mode 100644 src/Editors/LevelEditor/AI/path_manager.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_game.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_game_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_game_level.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_game_level_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_game_vertex_type.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_game_vertex_type_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_generic.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_generic_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_evaluator.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_evaluator_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_flooder.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_flooder_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_straight_line.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_level_straight_line_inline.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_params_flooder.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_params_game_level.h delete mode 100644 src/Editors/LevelEditor/AI/path_manager_params_straight_line.h delete mode 100644 src/utils/xrAI/path_manager.h delete mode 100644 src/utils/xrAI/path_manager_game.h delete mode 100644 src/utils/xrAI/path_manager_game_inline.h delete mode 100644 src/utils/xrAI/path_manager_game_level.h delete mode 100644 src/utils/xrAI/path_manager_game_level_inline.h delete mode 100644 src/utils/xrAI/path_manager_game_vertex_type.h delete mode 100644 src/utils/xrAI/path_manager_game_vertex_type_inline.h delete mode 100644 src/utils/xrAI/path_manager_generic.h delete mode 100644 src/utils/xrAI/path_manager_generic_inline.h delete mode 100644 src/utils/xrAI/path_manager_level.h delete mode 100644 src/utils/xrAI/path_manager_level_evaluator.h delete mode 100644 src/utils/xrAI/path_manager_level_evaluator_inline.h delete mode 100644 src/utils/xrAI/path_manager_level_flooder.h delete mode 100644 src/utils/xrAI/path_manager_level_flooder_inline.h delete mode 100644 src/utils/xrAI/path_manager_level_inline.h delete mode 100644 src/utils/xrAI/path_manager_level_straight_line.h delete mode 100644 src/utils/xrAI/path_manager_level_straight_line_inline.h delete mode 100644 src/utils/xrAI/path_manager_params_flooder.h delete mode 100644 src/utils/xrAI/path_manager_params_game_level.h delete mode 100644 src/utils/xrAI/path_manager_params_straight_line.h delete mode 100644 src/xrGame/path_manager.h delete mode 100644 src/xrGame/path_manager_game.h delete mode 100644 src/xrGame/path_manager_game_inline.h delete mode 100644 src/xrGame/path_manager_game_level.h delete mode 100644 src/xrGame/path_manager_game_level_inline.h delete mode 100644 src/xrGame/path_manager_game_vertex.h delete mode 100644 src/xrGame/path_manager_game_vertex_inline.h delete mode 100644 src/xrGame/path_manager_generic.h delete mode 100644 src/xrGame/path_manager_generic_inline.h delete mode 100644 src/xrGame/path_manager_level.h delete mode 100644 src/xrGame/path_manager_level_flooder.h delete mode 100644 src/xrGame/path_manager_level_flooder_inline.h delete mode 100644 src/xrGame/path_manager_level_inline.h delete mode 100644 src/xrGame/path_manager_level_nearest_vertex.h delete mode 100644 src/xrGame/path_manager_level_nearest_vertex_inline.h delete mode 100644 src/xrGame/path_manager_level_straight_line.h delete mode 100644 src/xrGame/path_manager_level_straight_line_inline.h delete mode 100644 src/xrGame/path_manager_params_flooder.h delete mode 100644 src/xrGame/path_manager_params_game_level.h delete mode 100644 src/xrGame/path_manager_params_game_vertex.h delete mode 100644 src/xrGame/path_manager_params_nearest_vertex.h delete mode 100644 src/xrGame/path_manager_params_straight_line.h delete mode 100644 src/xrGame/path_manager_solver.h delete mode 100644 src/xrGame/path_manager_solver_inline.h diff --git a/src/Editors/LevelEditor/AI/graph_engine_editor.h b/src/Editors/LevelEditor/AI/graph_engine_editor.h index 21182871cb..6eedb85c88 100644 --- a/src/Editors/LevelEditor/AI/graph_engine_editor.h +++ b/src/Editors/LevelEditor/AI/graph_engine_editor.h @@ -8,5 +8,5 @@ #pragma once -#include "path_manager.h" +#include "path_manager_params.h" #include "graph_engine_editor_space.h" diff --git a/src/Editors/LevelEditor/AI/path_manager.h b/src/Editors/LevelEditor/AI/path_manager.h deleted file mode 100644 index 83f18558c3..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager.h +++ /dev/null @@ -1,46 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_generic.h" - -template < - typename _Graph, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager : - public CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -}; - -// path manager parameters -#include "path_manager_params.h" -#include "path_manager_params_flooder.h" -#include "path_manager_params_straight_line.h" - -// path manager specializations -#include "path_manager_game.h" - - -#include "path_manager_game_level.h" - -#include "path_manager_level.h" -#include "path_manager_level_flooder.h" - -#include "path_manager_level_straight_line.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_game.h b/src/Editors/LevelEditor/AI/path_manager_game.h deleted file mode 100644 index c42c6eaf06..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_game.h +++ /dev/null @@ -1,59 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Game path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" - -template < - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - IGameGraph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - IGameGraph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef IGameGraph _Graph; - typedef typename CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - const _Graph::CVertex *goal_vertex; - -public: - - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i) const; - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_limit_reached (const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; -}; - -#include "path_manager_game_inline.h" diff --git a/src/Editors/LevelEditor/AI/path_manager_game_inline.h b/src/Editors/LevelEditor/AI/path_manager_game_inline.h deleted file mode 100644 index 73d802f419..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_game_inline.h +++ /dev/null @@ -1,77 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Game path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGamePathManager CPathManager - -TEMPLATE_SPECIALIZATION -CGamePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGamePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - goal_vertex = this->graph->vertex(this->goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGamePathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i) const -{ - VERIFY (this->graph); - return ((*i).distance()); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGamePathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (goal_vertex->game_point().distance_to(this->graph->vertex(node_index)->game_point())); -} - -TEMPLATE_SPECIALIZATION -IC bool CGamePathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return (false); -} - -TEMPLATE_SPECIALIZATION -IC bool CGamePathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (this->graph); - return (this->graph->accessible(vertex_id)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGamePathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_game_level.h b/src/Editors/LevelEditor/AI/path_manager_game_level.h deleted file mode 100644 index 9ad4b83ded..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_game_level.h +++ /dev/null @@ -1,75 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_level.h -// Created : 04.10.2004 -// Modified : 04.10.2004 -// Author : Dmitriy Iassenev -// Description : Game level path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" -#include "path_manager_params_game_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - IGameGraph, - _DataStorage, - SGameLevel< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - IGameGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef IGameGraph _Graph; - typedef SGameLevel< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_game_level_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_game_level_inline.h b/src/Editors/LevelEditor/AI/path_manager_game_level_inline.h deleted file mode 100644 index a290477ebe..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_game_level_inline.h +++ /dev/null @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type_inline.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGameVertexTypePathManager CPathManager<\ - IGameGraph,\ - _DataStorage,\ - SGameLevel<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CGameVertexTypePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGameVertexTypePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator = ¶meters; - m_evaluator->m_vertex_id = _index_type(-1); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGameVertexTypePathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGameVertexTypePathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - if (this->graph->vertex(this->data_storage->get_best().index())->level_id() == m_evaluator->m_level_id) { - m_evaluator->m_vertex_id = this->data_storage->get_best().index(); - return (true); - } - return (false); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGameVertexTypePathManager::create_path (T &vertex) -{ - if (this->path) - inherited::create_path(vertex); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGameVertexTypePathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_game_vertex_type.h b/src/Editors/LevelEditor/AI/path_manager_game_vertex_type.h deleted file mode 100644 index b2c9638aa2..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_game_vertex_type.h +++ /dev/null @@ -1,75 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" -#include "path_manager_params_game_vertex_type.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - IGameGraph, - _DataStorage, - SVertexType< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - IGameGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef IGameGraph _Graph; - typedef SVertexType< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_game_vertex_type_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_game_vertex_type_inline.h b/src/Editors/LevelEditor/AI/path_manager_game_vertex_type_inline.h deleted file mode 100644 index ae34ba543a..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_game_vertex_type_inline.h +++ /dev/null @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type_inline.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGameVertexTypePathManager CPathManager<\ - IGameGraph,\ - _DataStorage,\ - SVertexType<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CGameVertexTypePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGameVertexTypePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator = ¶meters; - m_evaluator->m_vertex_id = _index_type(-1); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGameVertexTypePathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGameVertexTypePathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - if (graph->mask(m_evaluator->m_vertex_types,graph->vertex(data_storage->get_best().index())->vertex_type())) { - m_evaluator->m_vertex_id = data_storage->get_best().index(); - return (true); - } - return (false); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGameVertexTypePathManager::create_path (T &vertex) -{ - if (path) - inherited::create_path(vertex); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGameVertexTypePathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_generic.h b/src/Editors/LevelEditor/AI/path_manager_generic.h deleted file mode 100644 index 50fe7adf8e..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_generic.h +++ /dev/null @@ -1,55 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_generic.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Generic path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _Graph, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManagerGeneric -{ -protected: - const _Graph *graph; - _DataStorage *data_storage; - xr_vector<_index_type> *path; - _index_type start_node_index; - _index_type goal_node_index; - _dist_type max_range; - _iteration_type max_iteration_count; - u32 max_visited_node_count; - const _index_type *best_node_index; - -public: - typedef typename _Graph::const_iterator const_iterator; - - CPathManagerGeneric (); - virtual ~CPathManagerGeneric(); - IC void init (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const; - IC _dist_type estimate (const _index_type &vertex_id) const; - IC void init_path (); - template - IC void create_path (T &vertex); - IC const _index_type &start_node () const; - IC const _index_type &goal_node () const; - IC bool is_goal_reached (const _index_type &vertex_id) const; - IC bool is_limit_reached (const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_metric_euclidian () const; - IC void begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end); - IC const _index_type get_value (const_iterator &i) const; - IC void finalize (); - IC const const_iterator &edge (const_iterator &i) const; -}; - -#include "path_manager_generic_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_generic_inline.h b/src/Editors/LevelEditor/AI/path_manager_generic_inline.h deleted file mode 100644 index e9440a1cb8..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_generic_inline.h +++ /dev/null @@ -1,160 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_generic_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Generic path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _Graph,\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGenericPathManager CPathManagerGeneric<_Graph,_DataStorage,_Parameters,_dist_type,_index_type,_iteration_type> - -TEMPLATE_SPECIALIZATION -IC CGenericPathManager::CPathManagerGeneric () -{ - graph = 0; - data_storage = 0; - path = 0; -} - -TEMPLATE_SPECIALIZATION -CGenericPathManager::~CPathManagerGeneric () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::init () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶ms - ) -{ - graph = _graph; - data_storage = _data_storage; - path = _path; - start_node_index = _start_node_index; - goal_node_index = _goal_node_index; - max_visited_node_count = params.max_visited_node_count; - max_range = params.max_range; - max_iteration_count = params.max_iteration_count; -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGenericPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const -{ - VERIFY (graph); - return (graph->get_edge_weight(node_index1,node_index2,i)); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGenericPathManager::estimate (const _index_type &vertex_id) const -{ - VERIFY (graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::init_path () -{ - if (path) - path->clear (); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGenericPathManager::create_path (T &vertex) -{ - VERIFY (data_storage); -// Msg ("Path [IC=xxx][VNC=%d][BV=%f]",data_storage->get_visited_node_count(),data_storage->get_best().f()); - if (path) - data_storage->get_node_path (*path,&vertex); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CGenericPathManager::start_node () const -{ - return (start_node_index); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CGenericPathManager::goal_node () const -{ - return (goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_goal_reached (const _index_type &vertex_id) const -{ - return (vertex_id == goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (data_storage); - return ( - (data_storage->get_best().f() >= max_range) || - (iteration_count >= max_iteration_count) || - (data_storage->get_visited_node_count() >= max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (graph); - return (graph->is_accessible(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_metric_euclidian () const -{ -//#pragma todo("Dima to Dima : implement path manager for non-euclidian heuristics") - return (true); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end) -{ - best_node_index = &vertex_id; - graph->begin (vertex_id,begin,end); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type CGenericPathManager::get_value(const_iterator &i) const -{ - return (graph->value(*best_node_index,i)); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::finalize () -{ -} - -TEMPLATE_SPECIALIZATION -IC const typename CGenericPathManager::const_iterator &CGenericPathManager::edge (const_iterator &i) const -{ - return (i); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGenericPathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level.h b/src/Editors/LevelEditor/AI/path_manager_level.h deleted file mode 100644 index 9b2347dae9..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level.h +++ /dev/null @@ -1,87 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "level_graph.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SBaseParameters< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x1; -// float y1; - int z1; - int x2; -// float y2; - int z2; - int x3; -// float y3; - int z3; -// float square_size_y; -// float size_y; - float m_sqr_distance_xz; - float m_distance_xz; - _Graph::CVertex *best_node; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC void init (); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - IC bool is_limit_reached(const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC void begin (const _index_type &vertex_id, _Graph::const_iterator &begin, _Graph::const_iterator &end); - IC const _index_type get_value (_Graph::const_iterator &i) const; -}; - -#include "path_manager_level_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_evaluator.h b/src/Editors/LevelEditor/AI/path_manager_level_evaluator.h deleted file mode 100644 index 99a38d191c..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_evaluator.h +++ /dev/null @@ -1,66 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_evaluator.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level evaluator path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" -#include "path_manager_params_level_evaluator.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - CAbstractVertexEvaluator, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef CAbstractVertexEvaluator _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - IC void finalize (); -}; - -#include "path_manager_level_evaluator_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_evaluator_inline.h b/src/Editors/LevelEditor/AI/path_manager_level_evaluator_inline.h deleted file mode 100644 index caaca356fe..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_evaluator_inline.h +++ /dev/null @@ -1,90 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_evaluator_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level evaluator path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelEvaluatorPathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - CAbstractVertexEvaluator,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CLevelEvaluatorPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelEvaluatorPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - m_evaluator = ¶meters; - m_evaluator->max_range = parameters.m_fSearchRange; - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator->m_fBestCost= flt_max; - path = parameters.m_path; - graph->set_invalid_vertex(m_evaluator->m_dwBestNode); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelEvaluatorPathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelEvaluatorPathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - m_evaluator->m_tpCurrentNode = graph->vertex(node_index); - m_evaluator->m_fDistance = data_storage->get_best().g(); - float value = m_evaluator->ffEvaluate(); - if (value < m_evaluator->m_fBestCost) { - m_evaluator->m_fBestCost = value; - m_evaluator->m_dwBestNode = node_index; - } - - best_node = graph->vertex(node_index); -// y1 = (float)(best_node->position().y()); - - return (false); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelEvaluatorPathManager::finalize () -{ - if (path && graph->valid_vertex_id(m_evaluator->m_dwBestNode)) - data_storage->get_node_path(*path,&data_storage->get_node(m_evaluator->m_dwBestNode)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelEvaluatorPathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_flooder.h b/src/Editors/LevelEditor/AI/path_manager_level_flooder.h deleted file mode 100644 index 0dec7cb3d6..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_flooder.h +++ /dev/null @@ -1,79 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_flooder.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level flooder path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SFlooder< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SFlooder< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x0,y0; - u32 max_range_sqr; - float m_cell_dist; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC bool is_goal_reached (const _index_type &node_index); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_limit_reached(const _iteration_type iteration_count) const; - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_flooder_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_flooder_inline.h b/src/Editors/LevelEditor/AI/path_manager_level_flooder_inline.h deleted file mode 100644 index 3a326ec31d..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_flooder_inline.h +++ /dev/null @@ -1,113 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_flooder_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level flooder path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelFlooderPathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - SFlooder<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - - -TEMPLATE_SPECIALIZATION -CLevelFlooderPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelFlooderPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); -// graph->unpack_xz (graph->vertex(_start_node_index),start_position.x,start_position.y); - this->graph->unpack_xz (*this->graph->vertex(_start_node_index),x0,y0); - max_range_sqr = iFloor(_sqr(this->max_range)/this->m_sqr_distance_xz + .5f); - m_cell_dist = this->graph->header().cell_size(); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_goal_reached (const _index_type &node_index) -{ - VERIFY (this->path); - this->path->push_back (node_index); - this->best_node = this->graph->vertex(node_index); -// y1 = (float)(best_node->position().y()); - return (false); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelFlooderPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - return (m_cell_dist); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelFlooderPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_accessible (const _index_type &vertex_id) const -{ - if (!inherited::is_accessible(vertex_id)) - return (false); - int x4,y4; - this->graph->unpack_xz (this->graph->vertex(vertex_id),x4,y4); - return (u32(_sqr(x0 - x4) + _sqr(y0 - y4)) <= max_range_sqr); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return ( - (iteration_count >= this->max_iteration_count) || - (this->data_storage->get_visited_node_count() >= this->max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -template -IC void CLevelFlooderPathManager::create_path (T &vertex) -{ -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelFlooderPathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_inline.h b/src/Editors/LevelEditor/AI/path_manager_level_inline.h deleted file mode 100644 index 1ab71c2254..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_inline.h +++ /dev/null @@ -1,141 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelPathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - SBaseParameters<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CLevelPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_distance_xz = this->graph->header().cell_size(); - m_sqr_distance_xz = _sqr(this->graph->header().cell_size()); -// square_size_y = _sqr((float)(this->graph->header().factor_y()/32767.0)); -// size_y = (float)(this->graph->header().factor_y()/32767.0); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::init () -{ - const _Graph::CVertex &tNode1 = *this->graph->vertex(this->start_node_index); - this->graph->unpack_xz (tNode1,x2,z2); -// y2 = (float)(tNode1.position().y()); - - const _Graph::CVertex &tNode2 = *this->graph->vertex(this->goal_node_index); - this->graph->unpack_xz (tNode2,x3,z3); -// y3 = (float)(tNode2.position().y()); - x1 = x2; -// y1 = y2; - z1 = z2; -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - -// const _Graph::CVertex &tNode1 = *this->graph->vertex(node_index2); - -// y2 = (float)(tNode1.position().y()); - -// return (_sqrt(square_size_y*(float)_sqr(y2 - y1) + m_sqr_distance_xz)); - return (m_distance_xz);// + (y2 - y1)*size_y); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); -// return (_sqrt((float)(m_sqr_distance_xz*float(_sqr(x3 - x1) + _sqr(z3 - z1)) + square_size_y*(float)_sqr(y3 - y1)))); - return (2*m_distance_xz*_dist_type(_abs(x3 - x1) + _abs(z3 - z1)));// + _abs(y3 - y1)*size_y); -// int x = _abs(x3 - x1); -// int z = _abs(z3 - z1); -// return (m_distance_xz*_dist_type(_min(x,z)*3 + 2*_abs(x - z))); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_goal_reached (const _index_type &node_index) -{ - if (node_index == this->goal_node_index) - return (true); - - best_node = this->graph->vertex(node_index); - this->graph->unpack_xz (best_node,x1,z1); -// y1 = (float)(best_node->position().y()); - - return (false); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_limit_reached(const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return (inherited::is_limit_reached(iteration_count)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (this->graph); -// return (this->graph->valid_vertex_id(vertex_id)); - return (this->graph->is_accessible(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::begin (const _index_type &vertex_id,_Graph:: const_iterator &begin, _Graph::const_iterator &end) -{ - this->graph->begin (best_node,begin,end); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type CLevelPathManager::get_value (_Graph::const_iterator &i) const -{ - return (this->graph->value(best_node,i)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelPathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_straight_line.h b/src/Editors/LevelEditor/AI/path_manager_level_straight_line.h deleted file mode 100644 index 2c044f8f9f..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_straight_line.h +++ /dev/null @@ -1,72 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_straight_line.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level straight line path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SStraightLineParams< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SStraightLineParams< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_parameters; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_straight_line_inline.h" \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_level_straight_line_inline.h b/src/Editors/LevelEditor/AI/path_manager_level_straight_line_inline.h deleted file mode 100644 index b52a527ed6..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_level_straight_line_inline.h +++ /dev/null @@ -1,111 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_straight_line_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level straight line path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelStraightLinePathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - SStraightLineParams<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - - -TEMPLATE_SPECIALIZATION -CLevelStraightLinePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelStraightLinePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_parameters = ¶meters; - m_parameters->m_distance = m_parameters->max_range; -} - -TEMPLATE_SPECIALIZATION -template -IC void CLevelStraightLinePathManager::create_path (T &vertex) -{ - inherited::create_path (vertex); - - _dist_type fCumulativeDistance = 0, fLastDirectDistance = 0, fDirectDistance; - - Fvector tPosition = m_parameters->m_start_point; - - auto I = this->path->begin(); - auto E = this->path->end(); - _index_type &dwNode = *I; - for ( ++I; I != E; ++I) { - u32 vertex_id = this->graph->check_position_in_direction(dwNode,tPosition,this->graph->vertex_position(*I)); - if (this->graph->valid_vertex_id(vertex_id)) - fDirectDistance = tPosition.distance_to(this->graph->vertex_position(*I)); - else - fDirectDistance = m_parameters->max_range; - if (fDirectDistance == m_parameters->max_range) { - if (fLastDirectDistance == 0) { - fCumulativeDistance += this->graph->distance(dwNode,*I); - dwNode = *I; - } - else { - fCumulativeDistance += fLastDirectDistance; - fLastDirectDistance = 0; - dwNode = *--I; - } - tPosition = this->graph->vertex_position(dwNode); - } - else - fLastDirectDistance = fDirectDistance; - if (fCumulativeDistance + fLastDirectDistance >= m_parameters->max_range) { - m_parameters->m_distance = m_parameters->max_range; - return; - } - } - - u32 vertex_id = this->graph->check_position_in_direction(dwNode,tPosition,m_parameters->m_dest_point); - if (this->graph->valid_vertex_id(vertex_id)) - fDirectDistance = tPosition.distance_to(m_parameters->m_dest_point); - else - fDirectDistance = m_parameters->max_range; - if (fDirectDistance == m_parameters->max_range) - m_parameters->m_distance = fCumulativeDistance + fLastDirectDistance + m_parameters->m_dest_point.distance_to(this->graph->vertex_position((*this->path)[this->path->size() - 1])); - else - m_parameters->m_distance = fCumulativeDistance + fDirectDistance; -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelStraightLinePathManager \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_params.h b/src/Editors/LevelEditor/AI/path_manager_params.h index 12b11115e0..894c320ba4 100644 --- a/src/Editors/LevelEditor/AI/path_manager_params.h +++ b/src/Editors/LevelEditor/AI/path_manager_params.h @@ -37,4 +37,4 @@ struct SBaseParameters { { return (true); } -}; \ No newline at end of file +}; diff --git a/src/Editors/LevelEditor/AI/path_manager_params_flooder.h b/src/Editors/LevelEditor/AI/path_manager_params_flooder.h deleted file mode 100644 index bddd7516bd..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_params_flooder.h +++ /dev/null @@ -1,39 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_flooder.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Flooder path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SFlooder : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - u32 m_dummy; - IC SFlooder ( - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = 65530 - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ) - { - } -}; \ No newline at end of file diff --git a/src/Editors/LevelEditor/AI/path_manager_params_game_level.h b/src/Editors/LevelEditor/AI/path_manager_params_game_level.h deleted file mode 100644 index bb04bc208a..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_params_game_level.h +++ /dev/null @@ -1,51 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_selector.h -// Created : 21.03.2002 -// Modified : 19.11.2003 -// Author : Dmitriy Iassenev -// Description : Game selector -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_params.h" - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SGameLevel : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - u32 m_level_id; - _index_type m_vertex_id; - xr_vector<_index_type> *m_path; - - IC SGameLevel ( - u32 level_id, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - _index_type max_visited_node_count = _index_type(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_level_id(level_id) - { - } - - IC _index_type selected_vertex_id() const - { - return (m_vertex_id); - } -}; diff --git a/src/Editors/LevelEditor/AI/path_manager_params_straight_line.h b/src/Editors/LevelEditor/AI/path_manager_params_straight_line.h deleted file mode 100644 index 4b37b56466..0000000000 --- a/src/Editors/LevelEditor/AI/path_manager_params_straight_line.h +++ /dev/null @@ -1,47 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_straight_line.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Straight line path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SStraightLineParams : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - Fvector m_start_point; - Fvector m_dest_point; - _dist_type m_distance; - - IC SStraightLineParams ( - const Fvector &start_point, - const Fvector &dest_point, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = u32(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_start_point(start_point), - m_dest_point(dest_point) - { - } -}; - diff --git a/src/utils/xrAI/graph_engine.h b/src/utils/xrAI/graph_engine.h index 850fe4beef..e1c95fd1c6 100644 --- a/src/utils/xrAI/graph_engine.h +++ b/src/utils/xrAI/graph_engine.h @@ -8,7 +8,7 @@ #pragma once -#include "path_manager.h" +#include "path_manager_params.h" #include "../xrEngine/AI/graph_engine_space.h" #ifndef AI_COMPILER diff --git a/src/utils/xrAI/path_manager.h b/src/utils/xrAI/path_manager.h deleted file mode 100644 index 8a732948e8..0000000000 --- a/src/utils/xrAI/path_manager.h +++ /dev/null @@ -1,58 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_generic.h" - -template < - typename _Graph, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager : - public CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -}; - -// path manager parameters -#include "path_manager_params.h" -#include "path_manager_params_flooder.h" -#include "path_manager_params_straight_line.h" -#ifndef AI_COMPILER -# include "path_manager_params_nearest_vertex.h" -#endif - -// path manager specializations -#include "path_manager_game.h" - -#ifndef AI_COMPILER -# include "path_manager_game_vertex_type.h" -# include "path_manager_game_vertex.h" -#endif - -#include "path_manager_game_level.h" - -#include "path_manager_level.h" -#include "path_manager_level_flooder.h" - -#ifdef AI_COMPILER -# include "path_manager_level_straight_line.h" -#else -# include "path_manager_level_nearest_vertex.h" -# include "path_manager_solver.h" -#endif \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_game.h b/src/utils/xrAI/path_manager_game.h deleted file mode 100644 index 73a96f5c87..0000000000 --- a/src/utils/xrAI/path_manager_game.h +++ /dev/null @@ -1,59 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Game path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" - -template < - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CGameGraph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - CGameGraph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CGameGraph _Graph; - typedef typename CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - const _Graph::CVertex *goal_vertex; - -public: - - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i) const; - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_limit_reached (const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; -}; - -#include "path_manager_game_inline.h" diff --git a/src/utils/xrAI/path_manager_game_inline.h b/src/utils/xrAI/path_manager_game_inline.h deleted file mode 100644 index 5884a9b399..0000000000 --- a/src/utils/xrAI/path_manager_game_inline.h +++ /dev/null @@ -1,77 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Game path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGamePathManager CPathManager - -TEMPLATE_SPECIALIZATION -CGamePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGamePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - goal_vertex = this->graph->vertex(this->goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGamePathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i) const -{ - VERIFY (this->graph); - return ((*i).distance()); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGamePathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (this->goal_vertex->game_point().distance_to(this->graph->vertex(node_index)->game_point())); -} - -TEMPLATE_SPECIALIZATION -IC bool CGamePathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return (false); -} - -TEMPLATE_SPECIALIZATION -IC bool CGamePathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (this->graph); - return (this->graph->accessible(vertex_id)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGamePathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_game_level.h b/src/utils/xrAI/path_manager_game_level.h deleted file mode 100644 index b2f674bc9d..0000000000 --- a/src/utils/xrAI/path_manager_game_level.h +++ /dev/null @@ -1,75 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_level.h -// Created : 04.10.2004 -// Modified : 04.10.2004 -// Author : Dmitriy Iassenev -// Description : Game level path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" -#include "path_manager_params_game_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CGameGraph, - _DataStorage, - SGameLevel< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - CGameGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CGameGraph _Graph; - typedef SGameLevel< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_game_level_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_game_level_inline.h b/src/utils/xrAI/path_manager_game_level_inline.h deleted file mode 100644 index 9289fea245..0000000000 --- a/src/utils/xrAI/path_manager_game_level_inline.h +++ /dev/null @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type_inline.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGameVertexTypePathManager CPathManager<\ - CGameGraph,\ - _DataStorage,\ - SGameLevel<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CGameVertexTypePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGameVertexTypePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator = ¶meters; - m_evaluator->m_vertex_id = _index_type(-1); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGameVertexTypePathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGameVertexTypePathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - if (this->graph->vertex(this->data_storage->get_best().index())->level_id() == m_evaluator->m_level_id) { - m_evaluator->m_vertex_id = this->data_storage->get_best().index(); - return (true); - } - return (false); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGameVertexTypePathManager::create_path (T &vertex) -{ - if (this->path) - inherited::create_path(vertex); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGameVertexTypePathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_game_vertex_type.h b/src/utils/xrAI/path_manager_game_vertex_type.h deleted file mode 100644 index ff528be767..0000000000 --- a/src/utils/xrAI/path_manager_game_vertex_type.h +++ /dev/null @@ -1,75 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" -#include "path_manager_params_game_vertex_type.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CGameGraph, - _DataStorage, - SVertexType< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - CGameGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CGameGraph _Graph; - typedef SVertexType< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_game_vertex_type_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_game_vertex_type_inline.h b/src/utils/xrAI/path_manager_game_vertex_type_inline.h deleted file mode 100644 index b4faa02a14..0000000000 --- a/src/utils/xrAI/path_manager_game_vertex_type_inline.h +++ /dev/null @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type_inline.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGameVertexTypePathManager CPathManager<\ - CGameGraph,\ - _DataStorage,\ - SVertexType<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CGameVertexTypePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGameVertexTypePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator = ¶meters; - m_evaluator->m_vertex_id = _index_type(-1); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGameVertexTypePathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGameVertexTypePathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - if (graph->mask(m_evaluator->m_vertex_types,graph->vertex(data_storage->get_best().index())->vertex_type())) { - m_evaluator->m_vertex_id = data_storage->get_best().index(); - return (true); - } - return (false); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGameVertexTypePathManager::create_path (T &vertex) -{ - if (path) - inherited::create_path(vertex); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGameVertexTypePathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_generic.h b/src/utils/xrAI/path_manager_generic.h deleted file mode 100644 index 9bb951d1af..0000000000 --- a/src/utils/xrAI/path_manager_generic.h +++ /dev/null @@ -1,55 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_generic.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Generic path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _Graph, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManagerGeneric -{ -protected: - const _Graph *graph; - _DataStorage *data_storage; - xr_vector<_index_type> *path; - _index_type start_node_index; - _index_type goal_node_index; - _dist_type max_range; - _iteration_type max_iteration_count; - u32 max_visited_node_count; - const _index_type *best_node_index; - -public: - typedef typename _Graph::const_iterator const_iterator; - - CPathManagerGeneric (); - virtual ~CPathManagerGeneric(); - IC void init (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const; - IC _dist_type estimate (const _index_type &vertex_id) const; - IC void init_path (); - template - IC void create_path (T &vertex); - IC const _index_type &start_node () const; - IC const _index_type &goal_node () const; - IC bool is_goal_reached (const _index_type &vertex_id) const; - IC bool is_limit_reached (const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_metric_euclidian () const; - IC void begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end); - IC const _index_type get_value (const_iterator &i) const; - IC void finalize (); - IC const const_iterator &edge (const_iterator &i) const; -}; - -#include "path_manager_generic_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_generic_inline.h b/src/utils/xrAI/path_manager_generic_inline.h deleted file mode 100644 index 26505c24ba..0000000000 --- a/src/utils/xrAI/path_manager_generic_inline.h +++ /dev/null @@ -1,160 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_generic_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Generic path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _Graph,\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGenericPathManager CPathManagerGeneric<_Graph,_DataStorage,_Parameters,_dist_type,_index_type,_iteration_type> - -TEMPLATE_SPECIALIZATION -IC CGenericPathManager::CPathManagerGeneric () -{ - graph = 0; - data_storage = 0; - path = 0; -} - -TEMPLATE_SPECIALIZATION -CGenericPathManager::~CPathManagerGeneric () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::init () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶ms - ) -{ - graph = _graph; - data_storage = _data_storage; - path = _path; - start_node_index = _start_node_index; - goal_node_index = _goal_node_index; - max_visited_node_count = params.max_visited_node_count; - max_range = params.max_range; - max_iteration_count = params.max_iteration_count; -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGenericPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const -{ - VERIFY (graph); - return (graph->get_edge_weight(node_index1,node_index2,i)); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGenericPathManager::estimate (const _index_type &vertex_id) const -{ - VERIFY (graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::init_path () -{ - if (path) - path->clear (); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGenericPathManager::create_path (T &vertex) -{ - VERIFY (data_storage); -// Msg ("Path [IC=xxx][VNC=%d][BV=%f]",data_storage->get_visited_node_count(),data_storage->get_best().f()); - if (path) - data_storage->get_node_path (*path,&vertex); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CGenericPathManager::start_node () const -{ - return (start_node_index); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CGenericPathManager::goal_node () const -{ - return (goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_goal_reached (const _index_type &vertex_id) const -{ - return (vertex_id == goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (data_storage); - return ( - (data_storage->get_best().f() >= max_range) || - (iteration_count >= max_iteration_count) || - (data_storage->get_visited_node_count() >= max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (graph); - return (graph->is_accessible(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_metric_euclidian () const -{ -//#pragma todo("Dima to Dima : implement path manager for non-euclidian heuristics") - return (true); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end) -{ - best_node_index = &vertex_id; - graph->begin (vertex_id,begin,end); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type CGenericPathManager::get_value(const_iterator &i) const -{ - return (graph->value(*best_node_index,i)); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::finalize () -{ -} - -TEMPLATE_SPECIALIZATION -IC const typename CGenericPathManager::const_iterator &CGenericPathManager::edge (const_iterator &i) const -{ - return (i); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGenericPathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level.h b/src/utils/xrAI/path_manager_level.h deleted file mode 100644 index 5986432c54..0000000000 --- a/src/utils/xrAI/path_manager_level.h +++ /dev/null @@ -1,90 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "level_graph.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CLevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - CLevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CLevelGraph _Graph; - typedef SBaseParameters< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x1; -// float y1; - int z1; - int x2; -// float y2; - int z2; - int x3; -// float y3; - int z3; -// float square_size_y; -// float size_y; - float m_sqr_distance_xz; - float m_distance_xz; - _Graph::CVertex *best_node; - -public: - using const_iterator = typename _Graph::const_iterator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC void init (); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - IC bool is_limit_reached(const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC void begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end); - IC const _index_type get_value (const_iterator &i) const; -}; - -#include "path_manager_level_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_evaluator.h b/src/utils/xrAI/path_manager_level_evaluator.h deleted file mode 100644 index d330b8998c..0000000000 --- a/src/utils/xrAI/path_manager_level_evaluator.h +++ /dev/null @@ -1,66 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_evaluator.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level evaluator path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" -#include "path_manager_params_level_evaluator.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CLevelGraph, - _DataStorage, - CAbstractVertexEvaluator, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - CLevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CLevelGraph _Graph; - typedef CAbstractVertexEvaluator _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - IC void finalize (); -}; - -#include "path_manager_level_evaluator_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_evaluator_inline.h b/src/utils/xrAI/path_manager_level_evaluator_inline.h deleted file mode 100644 index d42bb31881..0000000000 --- a/src/utils/xrAI/path_manager_level_evaluator_inline.h +++ /dev/null @@ -1,90 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_evaluator_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level evaluator path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelEvaluatorPathManager CPathManager<\ - CLevelGraph,\ - _DataStorage,\ - CAbstractVertexEvaluator,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CLevelEvaluatorPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelEvaluatorPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - m_evaluator = ¶meters; - m_evaluator->max_range = parameters.m_fSearchRange; - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator->m_fBestCost= flt_max; - path = parameters.m_path; - graph->set_invalid_vertex(m_evaluator->m_dwBestNode); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelEvaluatorPathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelEvaluatorPathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - m_evaluator->m_tpCurrentNode = graph->vertex(node_index); - m_evaluator->m_fDistance = data_storage->get_best().g(); - float value = m_evaluator->ffEvaluate(); - if (value < m_evaluator->m_fBestCost) { - m_evaluator->m_fBestCost = value; - m_evaluator->m_dwBestNode = node_index; - } - - best_node = graph->vertex(node_index); -// y1 = (float)(best_node->position().y()); - - return (false); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelEvaluatorPathManager::finalize () -{ - if (path && graph->valid_vertex_id(m_evaluator->m_dwBestNode)) - data_storage->get_node_path(*path,&data_storage->get_node(m_evaluator->m_dwBestNode)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelEvaluatorPathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_flooder.h b/src/utils/xrAI/path_manager_level_flooder.h deleted file mode 100644 index ab51ea4549..0000000000 --- a/src/utils/xrAI/path_manager_level_flooder.h +++ /dev/null @@ -1,79 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_flooder.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level flooder path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CLevelGraph, - _DataStorage, - SFlooder< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - CLevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CLevelGraph _Graph; - typedef SFlooder< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x0,y0; - u32 max_range_sqr; - float m_cell_dist; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC bool is_goal_reached (const _index_type &node_index); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_limit_reached(const _iteration_type iteration_count) const; - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_flooder_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_flooder_inline.h b/src/utils/xrAI/path_manager_level_flooder_inline.h deleted file mode 100644 index 2eb42c1d3b..0000000000 --- a/src/utils/xrAI/path_manager_level_flooder_inline.h +++ /dev/null @@ -1,113 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_flooder_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level flooder path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelFlooderPathManager CPathManager<\ - CLevelGraph,\ - _DataStorage,\ - SFlooder<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - - -TEMPLATE_SPECIALIZATION -CLevelFlooderPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelFlooderPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); -// graph->unpack_xz (graph->vertex(_start_node_index),start_position.x,start_position.y); - this->graph->unpack_xz (*this->graph->vertex(_start_node_index),x0,y0); - max_range_sqr = iFloor(_sqr(this->max_range)/ this->m_sqr_distance_xz + .5f); - m_cell_dist = this->graph->header().cell_size(); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_goal_reached (const _index_type &node_index) -{ - VERIFY (this->path); - this->path->push_back (node_index); - this->best_node = this->graph->vertex(node_index); -// y1 = (float)(best_node->position().y()); - return (false); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelFlooderPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - return (this->m_cell_dist); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelFlooderPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_accessible (const _index_type &vertex_id) const -{ - if (!inherited::is_accessible(vertex_id)) - return (false); - int x4,y4; - this->graph->unpack_xz (this->graph->vertex(vertex_id),x4,y4); - return (u32(_sqr(x0 - x4) + _sqr(y0 - y4)) <= max_range_sqr); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return ( - (iteration_count >= this->max_iteration_count) || - (this->data_storage->get_visited_node_count() >= this->max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -template -IC void CLevelFlooderPathManager::create_path (T &vertex) -{ -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelFlooderPathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_inline.h b/src/utils/xrAI/path_manager_level_inline.h deleted file mode 100644 index bbeb87116e..0000000000 --- a/src/utils/xrAI/path_manager_level_inline.h +++ /dev/null @@ -1,141 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelPathManager CPathManager<\ - CLevelGraph,\ - _DataStorage,\ - SBaseParameters<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CLevelPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_distance_xz = this->graph->header().cell_size(); - m_sqr_distance_xz = _sqr(this->graph->header().cell_size()); -// square_size_y = _sqr((float)(graph->header().factor_y()/32767.0)); -// size_y = (float)(graph->header().factor_y()/32767.0); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::init () -{ - const _Graph::CVertex &tNode1 = *this->graph->vertex(this->start_node_index); - this->graph->unpack_xz (tNode1,x2,z2); -// y2 = (float)(tNode1.position().y()); - - const _Graph::CVertex &tNode2 = *this->graph->vertex(this->goal_node_index); - this->graph->unpack_xz (tNode2,x3,z3); -// y3 = (float)(tNode2.position().y()); - x1 = x2; -// y1 = y2; - z1 = z2; -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - -// const _Graph::CVertex &tNode1 = *graph->vertex(node_index2); - -// y2 = (float)(tNode1.position().y()); - -// return (_sqrt(square_size_y*(float)_sqr(y2 - y1) + m_sqr_distance_xz)); - return (m_distance_xz);// + (y2 - y1)*size_y); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); -// return (_sqrt((float)(m_sqr_distance_xz*float(_sqr(x3 - x1) + _sqr(z3 - z1)) + square_size_y*(float)_sqr(y3 - y1)))); - return (2*m_distance_xz*_dist_type(_abs(x3 - x1) + _abs(z3 - z1)));// + _abs(y3 - y1)*size_y); -// int x = _abs(x3 - x1); -// int z = _abs(z3 - z1); -// return (m_distance_xz*_dist_type(_min(x,z)*3 + 2*_abs(x - z))); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_goal_reached (const _index_type &node_index) -{ - if (node_index == this->goal_node_index) - return (true); - - best_node = this->graph->vertex(node_index); - this->graph->unpack_xz (best_node,x1,z1); -// y1 = (float)(best_node->position().y()); - - return (false); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_limit_reached(const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return (inherited::is_limit_reached(iteration_count)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (this->graph); -// return (graph->valid_vertex_id(vertex_id)); - return (this->graph->is_accessible(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end) -{ - this->graph->begin (best_node,begin,end); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type CLevelPathManager::get_value (const_iterator &i) const -{ - return (this->graph->value(best_node,i)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelPathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_straight_line.h b/src/utils/xrAI/path_manager_level_straight_line.h deleted file mode 100644 index 13e8632176..0000000000 --- a/src/utils/xrAI/path_manager_level_straight_line.h +++ /dev/null @@ -1,72 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_straight_line.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level straight line path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CLevelGraph, - _DataStorage, - SStraightLineParams< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - CLevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CLevelGraph _Graph; - typedef SStraightLineParams< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_parameters; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_straight_line_inline.h" \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_level_straight_line_inline.h b/src/utils/xrAI/path_manager_level_straight_line_inline.h deleted file mode 100644 index 0452a09aec..0000000000 --- a/src/utils/xrAI/path_manager_level_straight_line_inline.h +++ /dev/null @@ -1,111 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_straight_line_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level straight line path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelStraightLinePathManager CPathManager<\ - CLevelGraph,\ - _DataStorage,\ - SStraightLineParams<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - - -TEMPLATE_SPECIALIZATION -CLevelStraightLinePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelStraightLinePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_parameters = ¶meters; - m_parameters->m_distance = m_parameters->max_range; -} - -TEMPLATE_SPECIALIZATION -template -IC void CLevelStraightLinePathManager::create_path (T &vertex) -{ - inherited::create_path (vertex); - - _dist_type fCumulativeDistance = 0, fLastDirectDistance = 0, fDirectDistance; - - Fvector tPosition = m_parameters->m_start_point; - - auto I = this->path->begin(); - auto E = this->path->end(); - _index_type &dwNode = *I; - for ( ++I; I != E; ++I) { - u32 vertex_id = this->graph->check_position_in_direction(dwNode,tPosition, this->graph->vertex_position(*I)); - if (this->graph->valid_vertex_id(vertex_id)) - fDirectDistance = tPosition.distance_to(this->graph->vertex_position(*I)); - else - fDirectDistance = m_parameters->max_range; - if (fDirectDistance == m_parameters->max_range) { - if (fLastDirectDistance == 0) { - fCumulativeDistance += this->graph->distance(dwNode,*I); - dwNode = *I; - } - else { - fCumulativeDistance += fLastDirectDistance; - fLastDirectDistance = 0; - dwNode = *--I; - } - tPosition = this->graph->vertex_position(dwNode); - } - else - fLastDirectDistance = fDirectDistance; - if (fCumulativeDistance + fLastDirectDistance >= m_parameters->max_range) { - m_parameters->m_distance = m_parameters->max_range; - return; - } - } - - u32 vertex_id = this->graph->check_position_in_direction(dwNode,tPosition,m_parameters->m_dest_point); - if (this->graph->valid_vertex_id(vertex_id)) - fDirectDistance = tPosition.distance_to(m_parameters->m_dest_point); - else - fDirectDistance = m_parameters->max_range; - if (fDirectDistance == m_parameters->max_range) - m_parameters->m_distance = fCumulativeDistance + fLastDirectDistance + m_parameters->m_dest_point.distance_to(this->graph->vertex_position((*this->path)[this->path->size() - 1])); - else - m_parameters->m_distance = fCumulativeDistance + fDirectDistance; -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelStraightLinePathManager \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_params_flooder.h b/src/utils/xrAI/path_manager_params_flooder.h deleted file mode 100644 index 52f639bad9..0000000000 --- a/src/utils/xrAI/path_manager_params_flooder.h +++ /dev/null @@ -1,39 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_flooder.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Flooder path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SFlooder : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - u32 m_dummy; - IC SFlooder ( - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = 65530 - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ) - { - } -}; \ No newline at end of file diff --git a/src/utils/xrAI/path_manager_params_game_level.h b/src/utils/xrAI/path_manager_params_game_level.h deleted file mode 100644 index 960626fabe..0000000000 --- a/src/utils/xrAI/path_manager_params_game_level.h +++ /dev/null @@ -1,51 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_selector.h -// Created : 21.03.2002 -// Modified : 19.11.2003 -// Author : Dmitriy Iassenev -// Description : Game selector -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_params.h" - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SGameLevel : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - u32 m_level_id; - _index_type m_vertex_id; - xr_vector<_index_type> *m_path; - - IC SGameLevel ( - u32 level_id, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - _index_type max_visited_node_count = _index_type(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_level_id(level_id) - { - } - - IC _index_type selected_vertex_id() const - { - return (m_vertex_id); - } -}; diff --git a/src/utils/xrAI/path_manager_params_straight_line.h b/src/utils/xrAI/path_manager_params_straight_line.h deleted file mode 100644 index 1341cb6d6a..0000000000 --- a/src/utils/xrAI/path_manager_params_straight_line.h +++ /dev/null @@ -1,47 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_straight_line.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Straight line path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SStraightLineParams : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - Fvector m_start_point; - Fvector m_dest_point; - _dist_type m_distance; - - IC SStraightLineParams ( - const Fvector &start_point, - const Fvector &dest_point, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = u32(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_start_point(start_point), - m_dest_point(dest_point) - { - } -}; - diff --git a/src/xrEngine/AI/graph_engine.h b/src/xrEngine/AI/graph_engine.h index a2560375da..bffb9fcc0b 100644 --- a/src/xrEngine/AI/graph_engine.h +++ b/src/xrEngine/AI/graph_engine.h @@ -8,7 +8,6 @@ #pragma once -#include "path_manager.h" #include "graph_engine_space.h" #ifndef AI_COMPILER diff --git a/src/xrGame/abstract_path_manager_inline.h b/src/xrGame/abstract_path_manager_inline.h index 5f2a5681ca..3d149faacc 100644 --- a/src/xrGame/abstract_path_manager_inline.h +++ b/src/xrGame/abstract_path_manager_inline.h @@ -10,6 +10,7 @@ #include "ai_space.h" #include "graph_engine.h" +#include "path_manager_params.h" #define TEMPLATE_SPECIALIZATION template <\ typename _Graph,\ @@ -122,7 +123,6 @@ IC void CAbstractPathManager,u32,u32> } before_search (start_vertex_id,dest_vertex_id); - m_failed = !m_graph->Search(start_vertex_id,dest_vertex_id,m_path,m_evaluator->max_range,m_evaluator->max_iteration_count,m_evaluator->max_visited_node_count); after_search (); diff --git a/src/xrGame/alife_monster_detail_path_manager.cpp b/src/xrGame/alife_monster_detail_path_manager.cpp index b020f26fe8..508e089bdc 100644 --- a/src/xrGame/alife_monster_detail_path_manager.cpp +++ b/src/xrGame/alife_monster_detail_path_manager.cpp @@ -13,12 +13,10 @@ #include "alife_time_manager.h" #include "xrServer_Objects_ALife_Monsters.h" #include "game_graph.h" -#include "level_graph.h" -#include "../game_level_cross_table.h" #include "alife_smart_terrain_task.h" #include "alife_graph_registry.h" #include "graph_engine.h" -#include "alife_monster_brain.h" +#include "path_manager_params.h" CALifeMonsterDetailPathManager::CALifeMonsterDetailPathManager (object_type *object) { diff --git a/src/xrGame/path_manager.h b/src/xrGame/path_manager.h deleted file mode 100644 index 3737f8cb29..0000000000 --- a/src/xrGame/path_manager.h +++ /dev/null @@ -1,57 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_generic.h" - -template < - typename _Graph, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager : - public CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -}; - -// path manager parameters -#include "path_manager_params.h" -#include "path_manager_params_flooder.h" -#include "path_manager_params_straight_line.h" -#ifndef AI_COMPILER -# include "path_manager_params_nearest_vertex.h" -#endif - -// path manager specializations -#include "path_manager_game.h" - -#ifndef AI_COMPILER -# include "path_manager_game_vertex.h" -#endif - -#include "path_manager_game_level.h" - -#include "path_manager_level.h" -#include "path_manager_level_flooder.h" - -#ifdef AI_COMPILER -# include "path_manager_level_straight_line.h" -#else -# include "path_manager_level_nearest_vertex.h" -# include "path_manager_solver.h" -#endif \ No newline at end of file diff --git a/src/xrGame/path_manager_game.h b/src/xrGame/path_manager_game.h deleted file mode 100644 index fde0e7b069..0000000000 --- a/src/xrGame/path_manager_game.h +++ /dev/null @@ -1,59 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Game path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" - -template < - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - IGameGraph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - IGameGraph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef IGameGraph _Graph; - typedef typename CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - const _Graph::CVertex *goal_vertex; - -public: - - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i) const; - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_limit_reached (const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; -}; - -#include "path_manager_game_inline.h" diff --git a/src/xrGame/path_manager_game_inline.h b/src/xrGame/path_manager_game_inline.h deleted file mode 100644 index e891076421..0000000000 --- a/src/xrGame/path_manager_game_inline.h +++ /dev/null @@ -1,77 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Game path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGamePathManager CPathManager - -TEMPLATE_SPECIALIZATION -CGamePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGamePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - goal_vertex = this->graph->vertex(this->goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGamePathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i) const -{ - VERIFY (this->graph); - return ((*i).distance()); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGamePathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (goal_vertex->game_point().distance_to(this->graph->vertex(node_index)->game_point())); -} - -TEMPLATE_SPECIALIZATION -IC bool CGamePathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return (false); -} - -TEMPLATE_SPECIALIZATION -IC bool CGamePathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (this->graph); - return (this->graph->accessible(vertex_id)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGamePathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_game_level.h b/src/xrGame/path_manager_game_level.h deleted file mode 100644 index d411b644cb..0000000000 --- a/src/xrGame/path_manager_game_level.h +++ /dev/null @@ -1,75 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_level.h -// Created : 04.10.2004 -// Modified : 04.10.2004 -// Author : Dmitriy Iassenev -// Description : Game level path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" -#include "path_manager_params_game_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - IGameGraph, - _DataStorage, - SGameLevel< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - IGameGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef IGameGraph _Graph; - typedef SGameLevel< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_game_level_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_game_level_inline.h b/src/xrGame/path_manager_game_level_inline.h deleted file mode 100644 index bfc0f53439..0000000000 --- a/src/xrGame/path_manager_game_level_inline.h +++ /dev/null @@ -1,85 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_type_inline.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Game vertex type path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGameVertexTypePathManager CPathManager<\ - IGameGraph,\ - _DataStorage,\ - SGameLevel<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CGameVertexTypePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGameVertexTypePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator = ¶meters; - m_evaluator->m_vertex_id = _index_type(-1); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGameVertexTypePathManager::estimate (const _index_type &node_index) const -{ - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGameVertexTypePathManager::is_goal_reached(const _index_type &node_index) -{ - VERIFY (m_evaluator); - if (this->graph->vertex(this->data_storage->get_best().index())->level_id() == m_evaluator->m_level_id) { - m_evaluator->m_vertex_id = this->data_storage->get_best().index(); - return (true); - } - return (false); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGameVertexTypePathManager::create_path (T &vertex) -{ - if (this->path) - inherited::create_path(vertex); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGameVertexTypePathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_game_vertex.h b/src/xrGame/path_manager_game_vertex.h deleted file mode 100644 index 3768681f52..0000000000 --- a/src/xrGame/path_manager_game_vertex.h +++ /dev/null @@ -1,72 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex.h -// Created : 05.07.2006 -// Modified : 05.07.2006 -// Author : Dmitriy Iassenev -// Description : Game vertex path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "game_graph.h" -#include "path_manager_params_game_vertex.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - IGameGraph, - _DataStorage, - SGameVertex< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - IGameGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef IGameGraph _Graph; - typedef SGameVertex< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_evaluator; - bool m_start_is_accessible; - -public: - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - IC bool is_accessible (const _index_type &vertex_id) const; -}; - -#include "path_manager_game_vertex_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_game_vertex_inline.h b/src/xrGame/path_manager_game_vertex_inline.h deleted file mode 100644 index a92339ad42..0000000000 --- a/src/xrGame/path_manager_game_vertex_inline.h +++ /dev/null @@ -1,80 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex_inline.h -// Created : 05.07.2006 -// Modified : 05.07.2006 -// Author : Dmitriy Iassenev -// Description : Game vertex path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGameVertexPathManager CPathManager<\ - IGameGraph,\ - _DataStorage,\ - SGameVertex<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -IC void CGameVertexPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_evaluator = ¶meters; - m_evaluator->m_vertex_id = _index_type(-1); - m_start_is_accessible = is_accessible(_start_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGameVertexPathManager::is_accessible(const _index_type& vertex_id) const -{ - if (!inherited::is_accessible(vertex_id)) - return (false); - - if (!m_start_is_accessible) - return (true); - - using const_iterator_ = typename _Parameters::VERTEX_TYPES::const_iterator; -#ifdef DEBUG - if (m_evaluator->m_vertex_types->empty()) { - Msg("! warning : empty vertex types"); - } -#endif - const_iterator_ I = m_evaluator->m_vertex_types->begin(); - const_iterator_ E = m_evaluator->m_vertex_types->end(); - for (; I != E; ++I) - if (this->graph->mask((*I).tMask, this->graph->vertex(vertex_id)->vertex_type())) - return (true); - - return (false); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGameVertexTypePathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_generic.h b/src/xrGame/path_manager_generic.h deleted file mode 100644 index 9bb951d1af..0000000000 --- a/src/xrGame/path_manager_generic.h +++ /dev/null @@ -1,55 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_generic.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Generic path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _Graph, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManagerGeneric -{ -protected: - const _Graph *graph; - _DataStorage *data_storage; - xr_vector<_index_type> *path; - _index_type start_node_index; - _index_type goal_node_index; - _dist_type max_range; - _iteration_type max_iteration_count; - u32 max_visited_node_count; - const _index_type *best_node_index; - -public: - typedef typename _Graph::const_iterator const_iterator; - - CPathManagerGeneric (); - virtual ~CPathManagerGeneric(); - IC void init (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const; - IC _dist_type estimate (const _index_type &vertex_id) const; - IC void init_path (); - template - IC void create_path (T &vertex); - IC const _index_type &start_node () const; - IC const _index_type &goal_node () const; - IC bool is_goal_reached (const _index_type &vertex_id) const; - IC bool is_limit_reached (const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_metric_euclidian () const; - IC void begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end); - IC const _index_type get_value (const_iterator &i) const; - IC void finalize (); - IC const const_iterator &edge (const_iterator &i) const; -}; - -#include "path_manager_generic_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_generic_inline.h b/src/xrGame/path_manager_generic_inline.h deleted file mode 100644 index 77699f1a9e..0000000000 --- a/src/xrGame/path_manager_generic_inline.h +++ /dev/null @@ -1,160 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_generic_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Generic path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _Graph,\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CGenericPathManager CPathManagerGeneric<_Graph,_DataStorage,_Parameters,_dist_type,_index_type,_iteration_type> - -TEMPLATE_SPECIALIZATION -IC CGenericPathManager::CPathManagerGeneric () -{ - graph = 0; - data_storage = 0; - path = 0; -} - -TEMPLATE_SPECIALIZATION -CGenericPathManager::~CPathManagerGeneric () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::init () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶ms - ) -{ - graph = _graph; - data_storage = _data_storage; - path = _path; - start_node_index = _start_node_index; - goal_node_index = _goal_node_index; - max_visited_node_count = params.max_visited_node_count; - max_range = params.max_range; - max_iteration_count = params.max_iteration_count; -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGenericPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const -{ - VERIFY (graph); - return (graph->get_edge_weight(node_index1,node_index2,i)); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CGenericPathManager::estimate (const _index_type &vertex_id) const -{ - VERIFY (graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::init_path () -{ - if (path) - path->resize(0); -} - -TEMPLATE_SPECIALIZATION -template -IC void CGenericPathManager::create_path (T &vertex) -{ - VERIFY (data_storage); -// Msg ("Path [IC=xxx][VNC=%d][BV=%f]",data_storage->get_visited_node_count(),data_storage->get_best().f()); - if (path) - data_storage->get_node_path (*path,&vertex); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CGenericPathManager::start_node () const -{ - return (start_node_index); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CGenericPathManager::goal_node () const -{ - return (goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_goal_reached (const _index_type &vertex_id) const -{ - return (vertex_id == goal_node_index); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (data_storage); - return ( - (data_storage->get_best().f() >= max_range) || - (iteration_count >= max_iteration_count) || - (data_storage->get_visited_node_count() >= max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (graph); - return (graph->is_accessible(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC bool CGenericPathManager::is_metric_euclidian () const -{ -//#pragma todo("Dima to Dima : implement path manager for non-euclidian heuristics") - return (true); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::begin (const _index_type &vertex_id, const_iterator &begin, const_iterator &end) -{ - best_node_index = &vertex_id; - graph->begin (vertex_id,begin,end); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type CGenericPathManager::get_value(const_iterator &i) const -{ - return (graph->value(*best_node_index,i)); -} - -TEMPLATE_SPECIALIZATION -IC void CGenericPathManager::finalize () -{ -} - -TEMPLATE_SPECIALIZATION -IC const typename CGenericPathManager::const_iterator &CGenericPathManager::edge (const_iterator &i) const -{ - return (i); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CGenericPathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_level.h b/src/xrGame/path_manager_level.h deleted file mode 100644 index 79b9c7eb49..0000000000 --- a/src/xrGame/path_manager_level.h +++ /dev/null @@ -1,87 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "level_graph.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SBaseParameters< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManagerGeneric < - _Graph, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x1; -// float y1; - int z1; - int x2; -// float y2; - int z2; - int x3; -// float y3; - int z3; -// float square_size_y; -// float size_y; - float m_sqr_distance_xz; - float m_distance_xz; - _Graph::CVertex *best_node; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC void init (); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_goal_reached (const _index_type &node_index); - IC bool is_limit_reached(const _iteration_type iteration_count) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC void begin (const _index_type &vertex_id, _Graph::const_iterator &begin, _Graph::const_iterator &end); - IC const _index_type get_value (_Graph::const_iterator &i) const; -}; - -#include "path_manager_level_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_level_flooder.h b/src/xrGame/path_manager_level_flooder.h deleted file mode 100644 index 057c951256..0000000000 --- a/src/xrGame/path_manager_level_flooder.h +++ /dev/null @@ -1,79 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_flooder.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level flooder path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SFlooder< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SFlooder< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x0,y0; - u32 max_range_sqr; - float m_cell_dist; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC bool is_goal_reached (const _index_type &node_index); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_limit_reached(const _iteration_type iteration_count) const; - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_flooder_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_level_flooder_inline.h b/src/xrGame/path_manager_level_flooder_inline.h deleted file mode 100644 index 941dd2cbc3..0000000000 --- a/src/xrGame/path_manager_level_flooder_inline.h +++ /dev/null @@ -1,113 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_flooder_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level flooder path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelFlooderPathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - SFlooder<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - - -TEMPLATE_SPECIALIZATION -CLevelFlooderPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelFlooderPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); -// graph->unpack_xz (graph->vertex(_start_node_index),start_position.x,start_position.y); - this->graph->unpack_xz (*this->graph->vertex(_start_node_index),x0,y0); - max_range_sqr = iFloor(_sqr(this->max_range)/ this->m_sqr_distance_xz + .5f); - m_cell_dist = this->graph->header().cell_size(); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_goal_reached (const _index_type &node_index) -{ - VERIFY (this->path); - this->path->push_back (node_index); - this->best_node = this->graph->vertex(node_index); -// y1 = (float)(best_node->position().y()); - return (false); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelFlooderPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - return (m_cell_dist); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelFlooderPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_accessible (const _index_type &vertex_id) const -{ - if (!inherited::is_accessible(vertex_id)) - return (false); - int x4,y4; - this->graph->unpack_xz (this->graph->vertex(vertex_id),x4,y4); - return (u32(_sqr(x0 - x4) + _sqr(y0 - y4)) <= max_range_sqr); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelFlooderPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return ( - (iteration_count >= this->max_iteration_count) || - (this->data_storage->get_visited_node_count() >= this->max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -template -IC void CLevelFlooderPathManager::create_path (T &vertex) -{ -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelFlooderPathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_level_inline.h b/src/xrGame/path_manager_level_inline.h deleted file mode 100644 index 0d1402272b..0000000000 --- a/src/xrGame/path_manager_level_inline.h +++ /dev/null @@ -1,141 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelPathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - SBaseParameters<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CLevelPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_distance_xz = this->graph->header().cell_size(); - m_sqr_distance_xz = _sqr(this->graph->header().cell_size()); -// square_size_y = _sqr((float)(graph->header().factor_y()/32767.0)); -// size_y = (float)(graph->header().factor_y()/32767.0); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::init () -{ - const _Graph::CVertex &tNode1 = *this->graph->vertex(this->start_node_index); - this->graph->unpack_xz (tNode1,x2,z2); -// y2 = (float)(tNode1.position().y()); - - const _Graph::CVertex &tNode2 = *this->graph->vertex(this->goal_node_index); - this->graph->unpack_xz (tNode2,x3,z3); -// y3 = (float)(tNode2.position().y()); - x1 = x2; -// y1 = y2; - z1 = z2; -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - -// const _Graph::CVertex &tNode1 = *graph->vertex(node_index2); - -// y2 = (float)(tNode1.position().y()); - -// return (_sqrt(square_size_y*(float)_sqr(y2 - y1) + m_sqr_distance_xz)); - return (m_distance_xz);// + (y2 - y1)*size_y); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CLevelPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); -// return (_sqrt((float)(m_sqr_distance_xz*float(_sqr(x3 - x1) + _sqr(z3 - z1)) + square_size_y*(float)_sqr(y3 - y1)))); - return (2*m_distance_xz*_dist_type(_abs(x3 - x1) + _abs(z3 - z1)));// + _abs(y3 - y1)*size_y); -// int x = _abs(x3 - x1); -// int z = _abs(z3 - z1); -// return (m_distance_xz*_dist_type(_min(x,z)*3 + 2*_abs(x - z))); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_goal_reached (const _index_type &node_index) -{ - if (node_index == this->goal_node_index) - return (true); - - best_node = this->graph->vertex(node_index); - this->graph->unpack_xz (best_node,x1,z1); -// y1 = (float)(best_node->position().y()); - - return (false); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_limit_reached(const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return (inherited::is_limit_reached(iteration_count)); -} - -TEMPLATE_SPECIALIZATION -IC bool CLevelPathManager::is_accessible (const _index_type &vertex_id) const -{ - VERIFY (this->graph); -// return (graph->valid_vertex_id(vertex_id)); - return (this->graph->is_accessible(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC void CLevelPathManager::begin (const _index_type &vertex_id, _Graph::const_iterator &begin, _Graph::const_iterator &end) -{ - this->graph->begin (best_node,begin,end); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type CLevelPathManager::get_value (_Graph::const_iterator &i) const -{ - return (this->graph->value(best_node,i)); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelPathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_level_nearest_vertex.h b/src/xrGame/path_manager_level_nearest_vertex.h deleted file mode 100644 index fdc505c532..0000000000 --- a/src/xrGame/path_manager_level_nearest_vertex.h +++ /dev/null @@ -1,81 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_nearest_vertex.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : path manager level nearest vertex -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SNearestVertex< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SNearestVertex< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - int x0,y0; - u32 max_range_sqr; - float m_cell_dist; - Fvector m_target_position; - float m_best_distance_to_target; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC bool is_goal_reached (const _index_type &node_index); - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &i); - IC _dist_type estimate (const _index_type &node_index) const; - IC bool is_accessible (const _index_type &vertex_id) const; - IC bool is_limit_reached(const _iteration_type iteration_count) const; - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_nearest_vertex_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_level_nearest_vertex_inline.h b/src/xrGame/path_manager_level_nearest_vertex_inline.h deleted file mode 100644 index 8f5977afcc..0000000000 --- a/src/xrGame/path_manager_level_nearest_vertex_inline.h +++ /dev/null @@ -1,124 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_nearest_vertex_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : path manager level nearest vertex inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CNearestVertexPathManager CPathManager<\ - ILevelGraph,\ - _DataStorage,\ - SNearestVertex<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - -TEMPLATE_SPECIALIZATION -CNearestVertexPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CNearestVertexPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - - this->graph->unpack_xz (*this->graph->vertex(_start_node_index),x0,y0); - max_range_sqr = iFloor(_sqr(this->max_range)/ this->m_sqr_distance_xz + .5f); - m_cell_dist = this->graph->header().cell_size(); - - m_target_position = parameters.m_target_position; - m_best_distance_to_target = flt_max; - VERIFY (this->path); - this->path->clear (); -} - -TEMPLATE_SPECIALIZATION -IC bool CNearestVertexPathManager::is_goal_reached (const _index_type &node_index) -{ - VERIFY (this->path); - this->best_node = this->graph->vertex(node_index); - - float current_distance = m_target_position.distance_to_xz_sqr(this->graph->vertex_position(this->best_node)); - if (current_distance < m_best_distance_to_target) { - m_best_distance_to_target = current_distance; - this->path->clear (); - this->path->push_back (node_index); - } - - return (false); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CNearestVertexPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const _Graph::const_iterator &/**i/**/) -{ - VERIFY (this->graph); - return (m_cell_dist); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CNearestVertexPathManager::estimate (const _index_type &node_index) const -{ - VERIFY (this->graph); - return (_dist_type(0)); -} - -TEMPLATE_SPECIALIZATION -IC bool CNearestVertexPathManager::is_accessible (const _index_type &vertex_id) const -{ - if (!inherited::is_accessible(vertex_id)) - return (false); - - int x4,y4; - this->graph->unpack_xz (this->graph->vertex(vertex_id),x4,y4); - return (u32(_sqr(x0 - x4) + _sqr(y0 - y4)) <= max_range_sqr); -} - -TEMPLATE_SPECIALIZATION -IC bool CNearestVertexPathManager::is_limit_reached (const _iteration_type iteration_count) const -{ - VERIFY (this->data_storage); - return ( - (iteration_count >= this->max_iteration_count) || - (this->data_storage->get_visited_node_count() >= this->max_visited_node_count) - ); -} - -TEMPLATE_SPECIALIZATION -template -IC void CNearestVertexPathManager::create_path (T &vertex) -{ -} - -#undef TEMPLATE_SPECIALIZATION -#undef CNearestVertexPathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_level_straight_line.h b/src/xrGame/path_manager_level_straight_line.h deleted file mode 100644 index f055683acb..0000000000 --- a/src/xrGame/path_manager_level_straight_line.h +++ /dev/null @@ -1,72 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_straight_line.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level straight line path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_level.h" - -template < - typename _DataStorage, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - ILevelGraph, - _DataStorage, - SStraightLineParams< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > : public CPathManager < - ILevelGraph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef ILevelGraph _Graph; - typedef SStraightLineParams< - _dist_type, - _index_type, - _iteration_type - > _Parameters; - typedef typename CPathManager < - _Graph, - _DataStorage, - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >, - _dist_type, - _index_type, - _iteration_type - > inherited; - -protected: - _Parameters *m_parameters; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_index_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, _Parameters ¶ms); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_level_straight_line_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_level_straight_line_inline.h b/src/xrGame/path_manager_level_straight_line_inline.h deleted file mode 100644 index 04e90bd637..0000000000 --- a/src/xrGame/path_manager_level_straight_line_inline.h +++ /dev/null @@ -1,111 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_level_straight_line_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Level straight line path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename _DataStorage,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CLevelStraightLinePathManager CPathManager<\ - CLevelGraph,\ - _DataStorage,\ - SStraightLineParams<\ - _dist_type,\ - _index_type,\ - _iteration_type\ - >,\ - _dist_type,\ - _index_type,\ - _iteration_type\ -> - - -TEMPLATE_SPECIALIZATION -CLevelStraightLinePathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CLevelStraightLinePathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_index_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - _Parameters ¶meters - ) -{ - inherited::setup( - _graph, - _data_storage, - _path, - _start_node_index, - _goal_node_index, - parameters - ); - m_parameters = ¶meters; - m_parameters->m_distance = m_parameters->max_range; -} - -TEMPLATE_SPECIALIZATION -template -IC void CLevelStraightLinePathManager::create_path (T &vertex) -{ - inherited::create_path (vertex); - - _dist_type fCumulativeDistance = 0, fLastDirectDistance = 0, fDirectDistance; - - Fvector tPosition = m_parameters->m_start_point; - - xr_vector<_index_type>::iterator I = path->begin(); - xr_vector<_index_type>::iterator E = path->end(); - _index_type &dwNode = *I; - for ( ++I; I != E; ++I) { - u32 vertex_id = graph->check_position_in_direction(dwNode,tPosition,graph->vertex_position(*I)); - if (graph->valid_vertex_id(vertex_id)) - fDirectDistance = tPosition.distance_to(graph->vertex_position(*I)); - else - fDirectDistance = m_parameters->max_range; - if (fDirectDistance == m_parameters->max_range) { - if (fLastDirectDistance == 0) { - fCumulativeDistance += graph->distance(dwNode,*I); - dwNode = *I; - } - else { - fCumulativeDistance += fLastDirectDistance; - fLastDirectDistance = 0; - dwNode = *--I; - } - tPosition = graph->vertex_position(dwNode); - } - else - fLastDirectDistance = fDirectDistance; - if (fCumulativeDistance + fLastDirectDistance >= m_parameters->max_range) { - m_parameters->m_distance = m_parameters->max_range; - return; - } - } - - u32 vertex_id = graph->check_position_in_direction(dwNode,tPosition,m_parameters->m_dest_point); - if (graph->valid_vertex_id(vertex_id)) - fDirectDistance = tPosition.distance_to(m_parameters->m_dest_point); - else - fDirectDistance = m_parameters->max_range; - if (fDirectDistance == m_parameters->max_range) - m_parameters->m_distance = fCumulativeDistance + fLastDirectDistance + m_parameters->m_dest_point.distance_to(graph->vertex_position((*path)[path->size() - 1])); - else - m_parameters->m_distance = fCumulativeDistance + fDirectDistance; -} - -#undef TEMPLATE_SPECIALIZATION -#undef CLevelStraightLinePathManager \ No newline at end of file diff --git a/src/xrGame/path_manager_params.h b/src/xrGame/path_manager_params.h index 4b58c9fcbf..8303ca7f5b 100644 --- a/src/xrGame/path_manager_params.h +++ b/src/xrGame/path_manager_params.h @@ -39,4 +39,46 @@ struct SBaseParameters { { return (true); } -}; \ No newline at end of file +}; + + +template < + typename _dist_type, + typename _index_type, + typename _iteration_type +> +struct SGameVertex : public SBaseParameters< + _dist_type, + _index_type, + _iteration_type +> { + typedef GameGraph::TERRAIN_VECTOR VERTEX_TYPES; + + const VERTEX_TYPES *m_vertex_types; + _index_type m_vertex_id; + + IC SGameVertex ( + const VERTEX_TYPES &vertex_types, + _dist_type max_range = _dist_type(6000), + _iteration_type max_iteration_count = _iteration_type(-1), + _index_type max_visited_node_count = _index_type(-1) + ) + : + SBaseParameters< + _dist_type, + _index_type, + _iteration_type + >( + max_range, + max_iteration_count, + max_visited_node_count + ) + { + m_vertex_types = &vertex_types; + } + + IC _index_type selected_vertex_id() const + { + return (m_vertex_id); + } +}; diff --git a/src/xrGame/path_manager_params_flooder.h b/src/xrGame/path_manager_params_flooder.h deleted file mode 100644 index 52f639bad9..0000000000 --- a/src/xrGame/path_manager_params_flooder.h +++ /dev/null @@ -1,39 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_flooder.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Flooder path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SFlooder : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - u32 m_dummy; - IC SFlooder ( - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = 65530 - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ) - { - } -}; \ No newline at end of file diff --git a/src/xrGame/path_manager_params_game_level.h b/src/xrGame/path_manager_params_game_level.h deleted file mode 100644 index ce3e4fe3fb..0000000000 --- a/src/xrGame/path_manager_params_game_level.h +++ /dev/null @@ -1,50 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_selector.h -// Created : 21.03.2002 -// Modified : 19.11.2003 -// Author : Dmitriy Iassenev -// Description : Game selector -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_params.h" - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SGameLevel : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - u32 m_level_id; - _index_type m_vertex_id; - - IC SGameLevel ( - u32 level_id, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - _index_type max_visited_node_count = _index_type(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_level_id(level_id) - { - } - - IC _index_type selected_vertex_id() const - { - return (m_vertex_id); - } -}; diff --git a/src/xrGame/path_manager_params_game_vertex.h b/src/xrGame/path_manager_params_game_vertex.h deleted file mode 100644 index c93d28df3e..0000000000 --- a/src/xrGame/path_manager_params_game_vertex.h +++ /dev/null @@ -1,53 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_game_vertex.h -// Created : 05.07.2006 -// Modified : 05.07.2006 -// Author : Dmitriy Iassenev -// Description : path manager parameters for game vertex path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "path_manager_params.h" -#include "game_graph_space.h" - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SGameVertex : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - typedef GameGraph::TERRAIN_VECTOR VERTEX_TYPES; - - const VERTEX_TYPES *m_vertex_types; - _index_type m_vertex_id; - - IC SGameVertex ( - const VERTEX_TYPES &vertex_types, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - _index_type max_visited_node_count = _index_type(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ) - { - m_vertex_types = &vertex_types; - } - - IC _index_type selected_vertex_id() const - { - return (m_vertex_id); - } -}; diff --git a/src/xrGame/path_manager_params_nearest_vertex.h b/src/xrGame/path_manager_params_nearest_vertex.h deleted file mode 100644 index ba657f5276..0000000000 --- a/src/xrGame/path_manager_params_nearest_vertex.h +++ /dev/null @@ -1,43 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_nearest_vertex.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Nearest vertex path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SNearestVertex : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - Fvector m_target_position; - - IC SNearestVertex ( - const Fvector &target_position, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = u32(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_target_position(target_position) - { - } -}; - diff --git a/src/xrGame/path_manager_params_straight_line.h b/src/xrGame/path_manager_params_straight_line.h deleted file mode 100644 index 1341cb6d6a..0000000000 --- a/src/xrGame/path_manager_params_straight_line.h +++ /dev/null @@ -1,47 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_params_straight_line.h -// Created : 21.03.2002 -// Modified : 04.03.2004 -// Author : Dmitriy Iassenev -// Description : Straight line path manager parameters -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -template < - typename _dist_type, - typename _index_type, - typename _iteration_type -> -struct SStraightLineParams : public SBaseParameters< - _dist_type, - _index_type, - _iteration_type -> { - Fvector m_start_point; - Fvector m_dest_point; - _dist_type m_distance; - - IC SStraightLineParams ( - const Fvector &start_point, - const Fvector &dest_point, - _dist_type max_range = _dist_type(6000), - _iteration_type max_iteration_count = _iteration_type(-1), - u32 max_visited_node_count = u32(-1) - ) - : - SBaseParameters< - _dist_type, - _index_type, - _iteration_type - >( - max_range, - max_iteration_count, - max_visited_node_count - ), - m_start_point(start_point), - m_dest_point(dest_point) - { - } -}; - diff --git a/src/xrGame/path_manager_solver.h b/src/xrGame/path_manager_solver.h deleted file mode 100644 index 6df65e3c10..0000000000 --- a/src/xrGame/path_manager_solver.h +++ /dev/null @@ -1,68 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_solver.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Solver path manager -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "problem_solver.h" - -template < - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - bool T6, - typename T7, - typename T8, - typename _DataStorage, - typename _Parameters, - typename _dist_type, - typename _index_type, - typename _iteration_type -> class CPathManager < - CProblemSolver, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > : public CPathManagerGeneric < - CProblemSolver, - _DataStorage, - _Parameters, - _dist_type, - _index_type, - _iteration_type - > -{ -protected: - typedef CProblemSolver _Graph; - typedef typename _Graph::_edge_type _edge_type; - -public: - using const_iterator = typename _Graph::const_iterator; -protected: - xr_vector<_edge_type> *m_edge_path; - const_iterator m_iterator; - -public: - virtual ~CPathManager (); - IC void setup (const _Graph *graph, _DataStorage *_data_storage, xr_vector<_edge_type> *_path, const _index_type &_start_node_index, const _index_type &_goal_node_index, const _Parameters ¶ms); - IC bool is_goal_reached (const _index_type &vertex_id) const; - IC const _index_type &get_value (const_iterator &i, bool reverse_search = T6) const; - IC const _edge_type &edge (const_iterator &i) const; - IC _dist_type evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const; - IC _dist_type estimate (const _index_type &vertex_id) const; - IC void init_path (); - template - IC void create_path (T &vertex, _DataStorage &data_storage, bool reverse_order); - template - IC void create_path (T &vertex); -}; - -#include "path_manager_solver_inline.h" \ No newline at end of file diff --git a/src/xrGame/path_manager_solver_inline.h b/src/xrGame/path_manager_solver_inline.h deleted file mode 100644 index 583131ed36..0000000000 --- a/src/xrGame/path_manager_solver_inline.h +++ /dev/null @@ -1,115 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// Module : path_manager_solver_inline.h -// Created : 21.03.2002 -// Modified : 03.03.2004 -// Author : Dmitriy Iassenev -// Description : Solver path manager inline functions -//////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define TEMPLATE_SPECIALIZATION \ - template <\ - typename T1,\ - typename T2,\ - typename T3,\ - typename T4,\ - typename T5,\ - bool T6,\ - typename T7,\ - typename T8,\ - typename _DataStorage,\ - typename _Parameters,\ - typename _dist_type,\ - typename _index_type,\ - typename _iteration_type\ - > - -#define CSolverPathManager CPathManager,_DataStorage,_Parameters,_dist_type,_index_type,_iteration_type> - -TEMPLATE_SPECIALIZATION -IC CSolverPathManager::~CPathManager () -{ -} - -TEMPLATE_SPECIALIZATION -IC void CSolverPathManager::setup ( - const _Graph *_graph, - _DataStorage *_data_storage, - xr_vector<_edge_type> *_path, - const _index_type &_start_node_index, - const _index_type &_goal_node_index, - const _Parameters ¶ms - ) -{ - this->graph = _graph; - this->data_storage = _data_storage; - m_edge_path = _path; - this->start_node_index = _start_node_index; - this->goal_node_index = _goal_node_index; - this->max_visited_node_count = params.max_visited_node_count; - this->max_range = decltype(this->max_range)(params.max_range); - this->max_iteration_count = params.max_iteration_count; -} - -TEMPLATE_SPECIALIZATION -IC bool CSolverPathManager::is_goal_reached (const _index_type &vertex_id) const -{ - return (this->graph->is_goal_reached(vertex_id)); -} - -TEMPLATE_SPECIALIZATION -IC const _index_type &CSolverPathManager::get_value(const_iterator &i, bool reverse_search) const -{ - return (this->graph->value(*this->best_node_index,i,reverse_search)); -} - -TEMPLATE_SPECIALIZATION -IC const typename CSolverPathManager::_edge_type &CSolverPathManager::edge (const_iterator &i) const -{ - return ((*i).m_operator_id); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CSolverPathManager::evaluate (const _index_type &node_index1, const _index_type &node_index2, const const_iterator &i) const -{ - VERIFY (this->graph); - return (this->graph->get_edge_weight(node_index1,node_index2,i)); -} - -TEMPLATE_SPECIALIZATION -IC _dist_type CSolverPathManager::estimate (const _index_type &vertex_id) const -{ - VERIFY (this->graph); -// return ((_dist_type)graph->get_edge_weight(vertex_id,start_node_index,m_iterator)); - return (1*(_dist_type)this->graph->estimate_edge_weight(vertex_id)); -// return ((_dist_type)0); -} - -TEMPLATE_SPECIALIZATION -IC void CSolverPathManager::init_path () -{ - if (m_edge_path) - m_edge_path->clear (); -} - -TEMPLATE_SPECIALIZATION -template -IC void CSolverPathManager::create_path (T &vertex, _DataStorage &data_storage, bool reverse_order) -{ - VERIFY (this->data_storage); - if (m_edge_path) - data_storage.get_edge_path (*m_edge_path,&vertex,reverse_order); -} - -TEMPLATE_SPECIALIZATION -template -IC void CSolverPathManager::create_path (T &vertex) -{ - VERIFY (this->data_storage); - if (m_edge_path) - this->data_storage->get_edge_path (*m_edge_path,&vertex, _Graph::reverse_search); -} - -#undef TEMPLATE_SPECIALIZATION -#undef CSolverPathManager \ No newline at end of file