summaryrefslogtreecommitdiff
path: root/src/pathfinder/yapf
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathfinder/yapf')
-rw-r--r--src/pathfinder/yapf/nodelist.hpp3
-rw-r--r--src/pathfinder/yapf/yapf_base.hpp6
-rw-r--r--src/pathfinder/yapf/yapf_common.hpp6
-rw-r--r--src/pathfinder/yapf/yapf_costcache.hpp24
-rw-r--r--src/pathfinder/yapf/yapf_costrail.hpp3
-rw-r--r--src/pathfinder/yapf/yapf_destrail.hpp9
-rw-r--r--src/pathfinder/yapf/yapf_rail.cpp9
-rw-r--r--src/pathfinder/yapf/yapf_road.cpp12
-rw-r--r--src/pathfinder/yapf/yapf_ship.cpp6
9 files changed, 52 insertions, 26 deletions
diff --git a/src/pathfinder/yapf/nodelist.hpp b/src/pathfinder/yapf/nodelist.hpp
index bc24e2893..5a92e4ae7 100644
--- a/src/pathfinder/yapf/nodelist.hpp
+++ b/src/pathfinder/yapf/nodelist.hpp
@@ -19,7 +19,8 @@
/**
* Hash table based node list multi-container class.
* Implements open list, closed list and priority queue for A-star
- * path finder. */
+ * path finder.
+ */
template <class Titem_, int Thash_bits_open_, int Thash_bits_closed_>
class CNodeList_HashTableT {
public:
diff --git a/src/pathfinder/yapf/yapf_base.hpp b/src/pathfinder/yapf/yapf_base.hpp
index f98a5163a..d3450b58c 100644
--- a/src/pathfinder/yapf/yapf_base.hpp
+++ b/src/pathfinder/yapf/yapf_base.hpp
@@ -116,7 +116,8 @@ public:
* - the destination was found
* - or the open list is empty (no route to destination).
* - or the maximum amount of loops reached - m_max_search_nodes (default = 10000)
- * @return true if the path was found */
+ * @return true if the path was found
+ */
inline bool FindPath(const VehicleType *v)
{
m_veh = v;
@@ -223,7 +224,8 @@ public:
/**
* AddNewNode() - called by Tderived::PfFollowNode() for each child node.
- * Nodes are evaluated here and added into open list */
+ * Nodes are evaluated here and added into open list
+ */
void AddNewNode(Node &n, const TrackFollower &tf)
{
/* evaluate the node */
diff --git a/src/pathfinder/yapf/yapf_common.hpp b/src/pathfinder/yapf/yapf_common.hpp
index cb53e2fa1..6add0b132 100644
--- a/src/pathfinder/yapf/yapf_common.hpp
+++ b/src/pathfinder/yapf/yapf_common.hpp
@@ -148,7 +148,8 @@ public:
/**
* Called by YAPF to calculate cost estimate. Calculates distance to the destination
- * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
+ * adds it to the actual cost from origin and stores the sum to the Node::m_estimate
+ */
inline bool PfCalcEstimate(Node& n)
{
static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
@@ -179,7 +180,8 @@ public:
* YAPF template that uses Ttypes template argument to determine all YAPF
* components (base classes) from which the actual YAPF is composed.
* For example classes consult: CYapfRail_TypesT template and its instantiations:
- * CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3 */
+ * CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3
+ */
template <class Ttypes>
class CYapfT
: public Ttypes::PfBase ///< Instance of CYapfBaseT - main YAPF loop and support base class
diff --git a/src/pathfinder/yapf/yapf_costcache.hpp b/src/pathfinder/yapf/yapf_costcache.hpp
index 988a13959..7e5354d95 100644
--- a/src/pathfinder/yapf/yapf_costcache.hpp
+++ b/src/pathfinder/yapf/yapf_costcache.hpp
@@ -28,7 +28,8 @@ public:
/**
* Called by YAPF to attach cached or local segment cost data to the given node.
- * @return true if globally cached data were used or false if local data was used */
+ * @return true if globally cached data were used or false if local data was used
+ */
FORCEINLINE bool PfNodeCacheFetch(Node& n)
{
return false;
@@ -36,7 +37,8 @@ public:
/**
* Called by YAPF to flush the cached segment cost data back into cache storage.
- * Current cache implementation doesn't use that. */
+ * Current cache implementation doesn't use that.
+ */
FORCEINLINE void PfNodeCacheFlush(Node& n)
{
}
@@ -71,7 +73,8 @@ protected:
public:
/**
* Called by YAPF to attach cached or local segment cost data to the given node.
- * @return true if globally cached data were used or false if local data was used */
+ * @return true if globally cached data were used or false if local data was used
+ */
FORCEINLINE bool PfNodeCacheFetch(Node& n)
{
CacheKey key(n.GetKey());
@@ -81,7 +84,8 @@ public:
/**
* Called by YAPF to flush the cached segment cost data back into cache storage.
- * Current cache implementation doesn't use that. */
+ * Current cache implementation doesn't use that.
+ */
FORCEINLINE void PfNodeCacheFlush(Node& n)
{
}
@@ -93,7 +97,8 @@ public:
* of track layout changes and static notification function called whenever
* the track layout changes. It is implemented as base class because it needs
* to be shared between all rail YAPF types (one shared counter, one notification
- * function. */
+ * function.
+ */
struct CSegmentCostCacheBase
{
static int s_rail_change_counter;
@@ -113,7 +118,8 @@ struct CSegmentCostCacheBase
* be always the same (TileIndex + DiagDirection) that represent the beginning
* of the segment (origin tile and exit-dir from this tile).
* Different CYapfCachedCostT types can share the same type of CSegmentCostCacheT.
- * Look at CYapfRailSegment (yapf_node_rail.hpp) for the segment example */
+ * Look at CYapfRailSegment (yapf_node_rail.hpp) for the segment example
+ */
template <class Tsegment>
struct CSegmentCostCacheT
: public CSegmentCostCacheBase
@@ -203,7 +209,8 @@ protected:
public:
/**
* Called by YAPF to attach cached or local segment cost data to the given node.
- * @return true if globally cached data were used or false if local data was used */
+ * @return true if globally cached data were used or false if local data was used
+ */
FORCEINLINE bool PfNodeCacheFetch(Node& n)
{
if (!Yapf().CanUseGlobalCache(n)) {
@@ -218,7 +225,8 @@ public:
/**
* Called by YAPF to flush the cached segment cost data back into cache storage.
- * Current cache implementation doesn't use that. */
+ * Current cache implementation doesn't use that.
+ */
FORCEINLINE void PfNodeCacheFlush(Node& n)
{
}
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp
index 088634daf..fe025ee26 100644
--- a/src/pathfinder/yapf/yapf_costrail.hpp
+++ b/src/pathfinder/yapf/yapf_costrail.hpp
@@ -279,7 +279,8 @@ public:
/**
* Called by YAPF to calculate the cost from the origin to the given node.
* Calculates only the cost of given node, adds it to the parent node cost
- * and stores the result into Node::m_cost member */
+ * and stores the result into Node::m_cost member
+ */
FORCEINLINE bool PfCalcCost(Node &n, const TrackFollower *tf)
{
assert(!n.flags_u.flags_s.m_targed_seen);
diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp
index 0b046b207..fa6ddfba3 100644
--- a/src/pathfinder/yapf/yapf_destrail.hpp
+++ b/src/pathfinder/yapf/yapf_destrail.hpp
@@ -65,7 +65,8 @@ public:
/**
* Called by YAPF to calculate cost estimate. Calculates distance to the destination
- * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
+ * adds it to the actual cost from origin and stores the sum to the Node::m_estimate
+ */
FORCEINLINE bool PfCalcEstimate(Node& n)
{
n.m_estimate = n.m_cost;
@@ -105,7 +106,8 @@ public:
/**
* Called by YAPF to calculate cost estimate. Calculates distance to the destination
- * adds it to the actual cost from origin and stores the sum to the Node::m_estimate. */
+ * adds it to the actual cost from origin and stores the sum to the Node::m_estimate.
+ */
FORCEINLINE bool PfCalcEstimate(Node& n)
{
n.m_estimate = n.m_cost;
@@ -185,7 +187,8 @@ public:
/**
* Called by YAPF to calculate cost estimate. Calculates distance to the destination
- * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
+ * adds it to the actual cost from origin and stores the sum to the Node::m_estimate
+ */
FORCEINLINE bool PfCalcEstimate(Node& n)
{
static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp
index 303cfd9e5..078a3e590 100644
--- a/src/pathfinder/yapf/yapf_rail.cpp
+++ b/src/pathfinder/yapf/yapf_rail.cpp
@@ -204,7 +204,8 @@ public:
/**
* Called by YAPF to move from the given node to the next tile. For each
* reachable trackdir on the new tile creates new node, initializes it
- * and adds it to the open list by calling Yapf().AddNewNode(n) */
+ * and adds it to the open list by calling Yapf().AddNewNode(n)
+ */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F(Yapf().GetVehicle());
@@ -299,7 +300,8 @@ public:
/**
* Called by YAPF to move from the given node to the next tile. For each
* reachable trackdir on the new tile creates new node, initializes it
- * and adds it to the open list by calling Yapf().AddNewNode(n) */
+ * and adds it to the open list by calling Yapf().AddNewNode(n)
+ */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F(Yapf().GetVehicle(), Yapf().GetCompatibleRailTypes());
@@ -381,7 +383,8 @@ public:
/**
* Called by YAPF to move from the given node to the next tile. For each
* reachable trackdir on the new tile creates new node, initializes it
- * and adds it to the open list by calling Yapf().AddNewNode(n) */
+ * and adds it to the open list by calling Yapf().AddNewNode(n)
+ */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F(Yapf().GetVehicle());
diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp
index 51162d3d2..c06870173 100644
--- a/src/pathfinder/yapf/yapf_road.cpp
+++ b/src/pathfinder/yapf/yapf_road.cpp
@@ -98,7 +98,8 @@ public:
/**
* Called by YAPF to calculate the cost from the origin to the given node.
* Calculates only the cost of given node, adds it to the parent node cost
- * and stores the result into Node::m_cost member */
+ * and stores the result into Node::m_cost member
+ */
FORCEINLINE bool PfCalcCost(Node& n, const TrackFollower *tf)
{
int segment_cost = 0;
@@ -189,7 +190,8 @@ public:
/**
* Called by YAPF to calculate cost estimate. Calculates distance to the destination
- * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
+ * adds it to the actual cost from origin and stores the sum to the Node::m_estimate
+ */
FORCEINLINE bool PfCalcEstimate(Node& n)
{
n.m_estimate = n.m_cost;
@@ -258,7 +260,8 @@ public:
/**
* Called by YAPF to calculate cost estimate. Calculates distance to the destination
- * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */
+ * adds it to the actual cost from origin and stores the sum to the Node::m_estimate
+ */
inline bool PfCalcEstimate(Node& n)
{
static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
@@ -308,7 +311,8 @@ public:
/**
* Called by YAPF to move from the given node to the next tile. For each
* reachable trackdir on the new tile creates new node, initializes it
- * and adds it to the open list by calling Yapf().AddNewNode(n) */
+ * and adds it to the open list by calling Yapf().AddNewNode(n)
+ */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F(Yapf().GetVehicle());
diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp
index f9e5c175d..b9c87bf9d 100644
--- a/src/pathfinder/yapf/yapf_ship.cpp
+++ b/src/pathfinder/yapf/yapf_ship.cpp
@@ -35,7 +35,8 @@ public:
/**
* Called by YAPF to move from the given node to the next tile. For each
* reachable trackdir on the new tile creates new node, initializes it
- * and adds it to the open list by calling Yapf().AddNewNode(n) */
+ * and adds it to the open list by calling Yapf().AddNewNode(n)
+ */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F(Yapf().GetVehicle());
@@ -119,7 +120,8 @@ public:
/**
* Called by YAPF to calculate the cost from the origin to the given node.
* Calculates only the cost of given node, adds it to the parent node cost
- * and stores the result into Node::m_cost member */
+ * and stores the result into Node::m_cost member
+ */
FORCEINLINE bool PfCalcCost(Node& n, const TrackFollower *tf)
{
/* base tile cost depending on distance */