equal
deleted
inserted
replaced
4 |
4 |
5 #ifndef YAPF_BASE_HPP |
5 #ifndef YAPF_BASE_HPP |
6 #define YAPF_BASE_HPP |
6 #define YAPF_BASE_HPP |
7 |
7 |
8 #include "../debug.h" |
8 #include "../debug.h" |
|
9 #include "../settings_type.h" |
9 |
10 |
10 extern int _total_pf_time_us; |
11 extern int _total_pf_time_us; |
11 |
12 |
12 /** CYapfBaseT - A-star type path finder base class. |
13 /** CYapfBaseT - A-star type path finder base class. |
13 * Derive your own pathfinder from it. You must provide the following template argument: |
14 * Derive your own pathfinder from it. You must provide the following template argument: |
50 |
51 |
51 NodeList m_nodes; ///< node list multi-container |
52 NodeList m_nodes; ///< node list multi-container |
52 protected: |
53 protected: |
53 Node* m_pBestDestNode; ///< pointer to the destination node found at last round |
54 Node* m_pBestDestNode; ///< pointer to the destination node found at last round |
54 Node* m_pBestIntermediateNode; ///< here should be node closest to the destination if path not found |
55 Node* m_pBestIntermediateNode; ///< here should be node closest to the destination if path not found |
55 const YapfSettings *m_settings; ///< current settings (_patches.yapf) |
56 const YAPFSettings *m_settings; ///< current settings (_settings.yapf) |
56 int m_max_search_nodes; ///< maximum number of nodes we are allowed to visit before we give up |
57 int m_max_search_nodes; ///< maximum number of nodes we are allowed to visit before we give up |
57 const Vehicle* m_veh; ///< vehicle that we are trying to drive |
58 const Vehicle* m_veh; ///< vehicle that we are trying to drive |
58 |
59 |
59 int m_stats_cost_calcs; ///< stats - how many node's costs were calculated |
60 int m_stats_cost_calcs; ///< stats - how many node's costs were calculated |
60 int m_stats_cache_hits; ///< stats - how many node's costs were reused from cache |
61 int m_stats_cache_hits; ///< stats - how many node's costs were reused from cache |
71 public: |
72 public: |
72 /// default constructor |
73 /// default constructor |
73 FORCEINLINE CYapfBaseT() |
74 FORCEINLINE CYapfBaseT() |
74 : m_pBestDestNode(NULL) |
75 : m_pBestDestNode(NULL) |
75 , m_pBestIntermediateNode(NULL) |
76 , m_pBestIntermediateNode(NULL) |
76 , m_settings(&_patches.yapf) |
77 , m_settings(&_settings.pf.yapf) |
77 , m_max_search_nodes(PfGetSettings().max_search_nodes) |
78 , m_max_search_nodes(PfGetSettings().max_search_nodes) |
78 , m_veh(NULL) |
79 , m_veh(NULL) |
79 , m_stats_cost_calcs(0) |
80 , m_stats_cost_calcs(0) |
80 , m_stats_cache_hits(0) |
81 , m_stats_cache_hits(0) |
81 , m_num_steps(0) |
82 , m_num_steps(0) |
89 /// to access inherited path finder |
90 /// to access inherited path finder |
90 FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);} |
91 FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);} |
91 |
92 |
92 public: |
93 public: |
93 /// return current settings (can be custom - player based - but later) |
94 /// return current settings (can be custom - player based - but later) |
94 FORCEINLINE const YapfSettings& PfGetSettings() const |
95 FORCEINLINE const YAPFSettings& PfGetSettings() const |
95 { |
96 { |
96 return *m_settings; |
97 return *m_settings; |
97 } |
98 } |
98 |
99 |
99 /** Main pathfinder routine: |
100 /** Main pathfinder routine: |