summaryrefslogtreecommitdiff
path: root/src/pathfinder
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathfinder')
-rw-r--r--src/pathfinder/follow_track.hpp6
-rw-r--r--src/pathfinder/npf/queue.h15
-rw-r--r--src/pathfinder/opf/opf_ship.cpp3
-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
12 files changed, 68 insertions, 34 deletions
diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp
index 424bdec17..d7d8569e9 100644
--- a/src/pathfinder/follow_track.hpp
+++ b/src/pathfinder/follow_track.hpp
@@ -24,7 +24,8 @@
/**
* Track follower helper template class (can serve pathfinders and vehicle
* controllers). See 6 different typedefs below for 3 different transport
- * types w/ or w/o 90-deg turns allowed */
+ * types w/ or w/o 90-deg turns allowed
+ */
template <TransportType Ttr_type_, typename VehicleType, bool T90deg_turns_allowed_ = true, bool Tmask_reserved_tracks = false>
struct CFollowTrackT
{
@@ -113,7 +114,8 @@ struct CFollowTrackT
/**
* main follower routine. Fills all members and return true on success.
- * Otherwise returns false if track can't be followed. */
+ * Otherwise returns false if track can't be followed.
+ */
inline bool Follow(TileIndex old_tile, Trackdir old_td)
{
m_old_tile = old_tile;
diff --git a/src/pathfinder/npf/queue.h b/src/pathfinder/npf/queue.h
index 3f042b7ad..d7a7a7919 100644
--- a/src/pathfinder/npf/queue.h
+++ b/src/pathfinder/npf/queue.h
@@ -100,7 +100,8 @@ void init_InsSort(Queue *q);
/**
* Initializes a binary heap and allocates internal memory for maximum of
- * max_size elements */
+ * max_size elements
+ */
void init_BinaryHeap(Queue *q, uint max_size);
@@ -137,22 +138,26 @@ struct Hash {
/**
* Deletes the value with the specified key pair from the hash and returns
* that value. Returns NULL when the value was not present. The value returned
- * is _not_ free()'d! */
+ * is _not_ free()'d!
+ */
void *Hash_Delete(Hash *h, uint key1, uint key2);
/**
* Sets the value associated with the given key pair to the given value.
- * Returns the old value if the value was replaced, NULL when it was not yet present. */
+ * Returns the old value if the value was replaced, NULL when it was not yet present.
+ */
void *Hash_Set(Hash *h, uint key1, uint key2, void *value);
/**
* Gets the value associated with the given key pair, or NULL when it is not
- * present. */
+ * present.
+ */
void *Hash_Get(const Hash *h, uint key1, uint key2);
/* Call these function to create/destroy a hash */
/**
* Builds a new hash in an existing struct. Make sure that hash() always
- * returns a hash less than num_buckets! Call delete_hash after use */
+ * returns a hash less than num_buckets! Call delete_hash after use
+ */
void init_Hash(Hash *h, Hash_HashProc *hash, uint num_buckets);
/**
* Deletes the hash and cleans up. Only cleans up memory allocated by new_Hash
diff --git a/src/pathfinder/opf/opf_ship.cpp b/src/pathfinder/opf/opf_ship.cpp
index 15c8a9ba7..2fef03e12 100644
--- a/src/pathfinder/opf/opf_ship.cpp
+++ b/src/pathfinder/opf/opf_ship.cpp
@@ -181,7 +181,8 @@ bad:;
/**
* returns the track to choose on the next tile, or -1 when it's better to
* reverse. The tile given is the tile we are about to enter, enterdir is the
- * direction in which we are entering the tile */
+ * direction in which we are entering the tile
+ */
Track OPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
{
assert(IsValidDiagDirection(enterdir));
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 */