summaryrefslogtreecommitdiff
path: root/yapf
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-09-04 20:40:33 +0000
committerrubidium <rubidium@openttd.org>2006-09-04 20:40:33 +0000
commit63687763e9680663e68754b47ee9f1511641faf8 (patch)
treeb1e52d993ce60e919358d998b36ea08adfe26cba /yapf
parenta7cfb80c40d9a4c544ece10872fd3808f9f59f8d (diff)
downloadopenttd-63687763e9680663e68754b47ee9f1511641faf8.tar.xz
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
-Cleanup: whitespace alignment of a few tables.
Diffstat (limited to 'yapf')
-rw-r--r--yapf/array.hpp2
-rw-r--r--yapf/autocopyptr.hpp20
-rw-r--r--yapf/binaryheap.hpp44
-rw-r--r--yapf/blob.hpp20
-rw-r--r--yapf/countedptr.hpp18
-rw-r--r--yapf/fixedsizearray.hpp8
-rw-r--r--yapf/follow_track.hpp6
-rw-r--r--yapf/hashtable.hpp42
-rw-r--r--yapf/nodelist.hpp4
-rw-r--r--yapf/unittest/test_yapf.h10
-rw-r--r--yapf/unittest/unittest.cpp34
-rw-r--r--yapf/yapf.h86
-rw-r--r--yapf/yapf_base.hpp78
-rw-r--r--yapf/yapf_common.hpp8
-rw-r--r--yapf/yapf_costcache.hpp50
-rw-r--r--yapf/yapf_costrail.hpp4
-rw-r--r--yapf/yapf_destrail.hpp4
-rw-r--r--yapf/yapf_rail.cpp8
-rw-r--r--yapf/yapf_road.cpp12
-rw-r--r--yapf/yapf_settings.h18
-rw-r--r--yapf/yapf_ship.cpp12
21 files changed, 244 insertions, 244 deletions
diff --git a/yapf/array.hpp b/yapf/array.hpp
index cfee3c3e6..0d330aeed 100644
--- a/yapf/array.hpp
+++ b/yapf/array.hpp
@@ -6,7 +6,7 @@
#include "fixedsizearray.hpp"
/** Flexible array with size limit. Implemented as fixed size
- array of fixed size arrays */
+ * array of fixed size arrays */
template <class Titem_, int Tblock_size_ = 1024, int Tnum_blocks_ = Tblock_size_>
class CArrayT {
public:
diff --git a/yapf/autocopyptr.hpp b/yapf/autocopyptr.hpp
index 46c727789..42822c324 100644
--- a/yapf/autocopyptr.hpp
+++ b/yapf/autocopyptr.hpp
@@ -4,16 +4,16 @@
#define AUTOCOPYPTR_HPP
/** CAutoCopyPtrT - kind of CoW (Copy on Write) pointer.
- It is non-invasive smart pointer (reference counter is held outside
- of Tdata).
- When copied, its new copy shares the same underlaying structure Tdata.
- When dereferenced, its behavior depends on 2 factors:
- - whether the data is shared (used by more than one pointer)
- - type of access (read/write)
- When shared pointer is dereferenced for write, new clone of Tdata
- is made first.
- Can't be used for polymorphic data types (interfaces).
-*/
+ * It is non-invasive smart pointer (reference counter is held outside
+ * of Tdata).
+ * When copied, its new copy shares the same underlaying structure Tdata.
+ * When dereferenced, its behavior depends on 2 factors:
+ * - whether the data is shared (used by more than one pointer)
+ * - type of access (read/write)
+ * When shared pointer is dereferenced for write, new clone of Tdata
+ * is made first.
+ * Can't be used for polymorphic data types (interfaces).
+ */
template <class Tdata_>
class CAutoCopyPtrT {
protected:
diff --git a/yapf/binaryheap.hpp b/yapf/binaryheap.hpp
index 9537dff63..7b72a25af 100644
--- a/yapf/binaryheap.hpp
+++ b/yapf/binaryheap.hpp
@@ -10,22 +10,22 @@
/**
-* Binary Heap as C++ template.
-*
-* For information about Binary Heap algotithm,
-* see: http://www.policyalmanac.org/games/binaryHeaps.htm
-*
-* Implementation specific notes:
-*
-* 1) It allocates space for item pointers (array). Items are allocated elsewhere.
-*
-* 2) ItemPtr [0] is never used. Total array size is max_items + 1, because we
-* use indices 1..max_items instead of zero based C indexing.
-*
-* 3) Item of the binary heap should support these public members:
-* - 'lower-then' operator '<' - used for comparing items before moving
-*
-*/
+ * Binary Heap as C++ template.
+ *
+ * For information about Binary Heap algotithm,
+ * see: http://www.policyalmanac.org/games/binaryHeaps.htm
+ *
+ * Implementation specific notes:
+ *
+ * 1) It allocates space for item pointers (array). Items are allocated elsewhere.
+ *
+ * 2) ItemPtr [0] is never used. Total array size is max_items + 1, because we
+ * use indices 1..max_items instead of zero based C indexing.
+ *
+ * 3) Item of the binary heap should support these public members:
+ * - 'lower-then' operator '<' - used for comparing items before moving
+ *
+ */
template <class Titem_>
class CBinaryHeapT {
@@ -53,23 +53,23 @@ public:
public:
/** Return the number of items stored in the priority queue.
- * @return number of items in the queue */
+ * @return number of items in the queue */
FORCEINLINE int Size() const {return m_size;};
/** Test if the priority queue is empty.
- * @return true if empty */
+ * @return true if empty */
FORCEINLINE bool IsEmpty() const {return (m_size == 0);};
/** Test if the priority queue is full.
- * @return true if full. */
+ * @return true if full. */
FORCEINLINE bool IsFull() const {return (m_size >= m_max_size);};
/** Find the smallest item in the priority queue.
- * Return the smallest item, or throw assert if empty. */
+ * Return the smallest item, or throw assert if empty. */
FORCEINLINE Titem_& GetHead() {assert(!IsEmpty()); return *m_items[1];}
/** Insert new item into the priority queue, maintaining heap order.
- * @return false if the queue is full. */
+ * @return false if the queue is full. */
bool Push(Titem_& new_item);
/** Remove and return the smallest item from the priority queue. */
@@ -85,7 +85,7 @@ public:
int FindLinear(const Titem_& item) const;
/** Make the priority queue empty.
- * All remaining items will remain untouched. */
+ * All remaining items will remain untouched. */
void Clear() {m_size = 0;};
/** verifies the heap consistency (added during first YAPF debug phase) */
diff --git a/yapf/blob.hpp b/yapf/blob.hpp
index 6cc460e41..8c2da84a4 100644
--- a/yapf/blob.hpp
+++ b/yapf/blob.hpp
@@ -11,14 +11,14 @@ FORCEINLINE void MemCpyT(Titem_* d, const Titem_* s, int num_items = 1)
/** Base class for simple binary blobs.
- Item is byte.
- The word 'simple' means:
- - no configurable allocator type (always made from heap)
- - no smart deallocation - deallocation must be called from the same
- module (DLL) where the blob was allocated
- - no configurable allocation policy (how big blocks should be allocated)
- - no extra ownership policy (i.e. 'copy on write') when blob is copied
- - no thread synchronization at all */
+ * Item is byte.
+ * The word 'simple' means:
+ * - no configurable allocator type (always made from heap)
+ * - no smart deallocation - deallocation must be called from the same
+ * module (DLL) where the blob was allocated
+ * - no configurable allocation policy (how big blocks should be allocated)
+ * - no extra ownership policy (i.e. 'copy on write') when blob is copied
+ * - no thread synchronization at all */
class CBlobBaseSimple {
protected:
struct CHdr {
@@ -78,7 +78,7 @@ public:
}
/** Reallocate if there is no free space for num_bytes bytes.
- @return pointer to the new data to be added */
+ * @return pointer to the new data to be added */
FORCEINLINE int8* MakeRawFreeSpace(int num_bytes)
{
assert(num_bytes >= 0);
@@ -89,7 +89,7 @@ public:
}
/** Increase RawSize() by num_bytes.
- @return pointer to the new data added */
+ * @return pointer to the new data added */
FORCEINLINE int8* GrowRawSize(int num_bytes)
{
int8* pNewData = MakeRawFreeSpace(num_bytes);
diff --git a/yapf/countedptr.hpp b/yapf/countedptr.hpp
index 1ac986cf5..c1bb48e06 100644
--- a/yapf/countedptr.hpp
+++ b/yapf/countedptr.hpp
@@ -6,15 +6,15 @@
/** @file CCountedPtr - smart pointer implementation */
/** CCountedPtr - simple reference counting smart pointer.
-*
-* One of the standard ways how to maintain object's lifetime.
-*
-* See http://ootips.org/yonat/4dev/smart-pointers.html for more
-* general info about smart pointers.
-*
-* This class implements ref-counted pointer for objects/interfaces that
-* support AddRef() and Release() methods.
-*/
+ *
+ * One of the standard ways how to maintain object's lifetime.
+ *
+ * See http://ootips.org/yonat/4dev/smart-pointers.html for more
+ * general info about smart pointers.
+ *
+ * This class implements ref-counted pointer for objects/interfaces that
+ * support AddRef() and Release() methods.
+ */
template <class Tcls_>
class CCountedPtr {
/** redefine the template argument to make it visible for derived classes */
diff --git a/yapf/fixedsizearray.hpp b/yapf/fixedsizearray.hpp
index 9d67c6877..06ff0703f 100644
--- a/yapf/fixedsizearray.hpp
+++ b/yapf/fixedsizearray.hpp
@@ -5,13 +5,13 @@
/** fixed size array
- Upon construction it preallocates fixed size block of memory
- for all items, but doesn't construct them. Item's construction
- is delayed. */
+ * Upon construction it preallocates fixed size block of memory
+ * for all items, but doesn't construct them. Item's construction
+ * is delayed. */
template <class Titem_, int Tcapacity_>
struct CFixedSizeArrayT {
/** the only member of fixed size array is pointer to the block
- of C array of items. Header can be found on the offset -sizeof(CHdr). */
+ * of C array of items. Header can be found on the offset -sizeof(CHdr). */
Titem_ *m_items;
/** header for fixed size array */
diff --git a/yapf/follow_track.hpp b/yapf/follow_track.hpp
index 5bb3ad8ac..218de53b4 100644
--- a/yapf/follow_track.hpp
+++ b/yapf/follow_track.hpp
@@ -6,8 +6,8 @@
#include "yapf.hpp"
/** Track follower helper template class (can serve pathfinders and vehicle
- controllers). See 6 different typedefs below for 3 different transport
- types w/ of w/o 90-deg turns allowed */
+ * controllers). See 6 different typedefs below for 3 different transport
+ * types w/ of w/o 90-deg turns allowed */
template <TransportType Ttr_type_, bool T90deg_turns_allowed_ = true>
struct CFollowTrackT : public FollowTrack_t
{
@@ -38,7 +38,7 @@ struct CFollowTrackT : public FollowTrack_t
FORCEINLINE static bool Allow90degTurns() {return T90deg_turns_allowed_;}
/** 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. */
FORCEINLINE bool Follow(TileIndex old_tile, Trackdir old_td)
{
m_old_tile = old_tile;
diff --git a/yapf/hashtable.hpp b/yapf/hashtable.hpp
index bab5bccfc..3933eb8f1 100644
--- a/yapf/hashtable.hpp
+++ b/yapf/hashtable.hpp
@@ -95,26 +95,26 @@ struct CHashTableSlotT
};
/** @class CHashTableT<Titem, Thash_bits> - simple hash table
- of pointers allocated elsewhere.
-
- Supports: Add/Find/Remove of Titems.
-
- Your Titem must meet some extra requirements to be CHashTableT
- compliant:
- - its constructor/destructor (if any) must be public
- - if the copying of item requires an extra resource management,
- you must define also copy constructor
- - must support nested type (struct, class or typedef) Titem::Key
- that defines the type of key class for that item
- - must support public method:
- const Key& GetKey() const; // return the item's key object
-
- In addition, the Titem::Key class must support:
- - public method that calculates key's hash:
- int CalcHash() const;
- - public 'equality' operator to compare the key with another one
- bool operator == (const Key& other) const;
-*/
+ * of pointers allocated elsewhere.
+ *
+ * Supports: Add/Find/Remove of Titems.
+ *
+ * Your Titem must meet some extra requirements to be CHashTableT
+ * compliant:
+ * - its constructor/destructor (if any) must be public
+ * - if the copying of item requires an extra resource management,
+ * you must define also copy constructor
+ * - must support nested type (struct, class or typedef) Titem::Key
+ * that defines the type of key class for that item
+ * - must support public method:
+ * const Key& GetKey() const; // return the item's key object
+ *
+ * In addition, the Titem::Key class must support:
+ * - public method that calculates key's hash:
+ * int CalcHash() const;
+ * - public 'equality' operator to compare the key with another one
+ * bool operator == (const Key& other) const;
+ */
template <class Titem_, int Thash_bits_>
class CHashTableT {
public:
@@ -125,7 +125,7 @@ public:
protected:
/** each slot contains pointer to the first item in the list,
- Titem contains pointer to the next item - GetHashNext(), SetHashNext() */
+ * Titem contains pointer to the next item - GetHashNext(), SetHashNext() */
typedef CHashTableSlotT<Titem_> Slot;
Slot* m_slots; // here we store our data (array of blobs)
diff --git a/yapf/nodelist.hpp b/yapf/nodelist.hpp
index 204282e93..5dc8170af 100644
--- a/yapf/nodelist.hpp
+++ b/yapf/nodelist.hpp
@@ -8,8 +8,8 @@
#include "binaryheap.hpp"
/** Hash table based node list multi-container class.
- Implements open list, closed list and priority queue for A-star
- path finder. */
+ * Implements open list, closed list and priority queue for A-star
+ * path finder. */
template <class Titem_, int Thash_bits_open_, int Thash_bits_closed_>
class CNodeList_HashTableT {
public:
diff --git a/yapf/unittest/test_yapf.h b/yapf/unittest/test_yapf.h
index 4e2f2c0e5..952040faa 100644
--- a/yapf/unittest/test_yapf.h
+++ b/yapf/unittest/test_yapf.h
@@ -160,8 +160,8 @@ struct CYapfTestBaseT
FORCEINLINE char TransportTypeChar() const {return 'T';}
/** 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) */
+ * reachable trackdir on the new tile creates new node, initializes it
+ * and adds it to the open list by calling Yapf().AddNewNode(n) */
FORCEINLINE void PfFollowNode(Node& org)
{
int x_org = org.m_key.m_x;
@@ -207,8 +207,8 @@ struct CYapfTestBaseT
}
/** 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 */
+ * Calculates only the cost of given node, adds it to the parent node cost
+ * and stores the result into Node::m_cost member */
FORCEINLINE bool PfCalcCost(Node& n)
{
// base tile cost depending on distance
@@ -225,7 +225,7 @@ struct CYapfTestBaseT
}
/** 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)
{
int dx = abs(n.m_key.m_x - m_x2);
diff --git a/yapf/unittest/unittest.cpp b/yapf/unittest/unittest.cpp
index 099862bee..33d3f3065 100644
--- a/yapf/unittest/unittest.cpp
+++ b/yapf/unittest/unittest.cpp
@@ -109,23 +109,23 @@ const TileIndexDiffC _tileoffs_by_dir[] = {
extern "C"
const byte _ffb_64[128] = {
- 0,0,1,0,2,0,1,0,
- 3,0,1,0,2,0,1,0,
- 4,0,1,0,2,0,1,0,
- 3,0,1,0,2,0,1,0,
- 5,0,1,0,2,0,1,0,
- 3,0,1,0,2,0,1,0,
- 4,0,1,0,2,0,1,0,
- 3,0,1,0,2,0,1,0,
-
- 0,0,0,2,0,4,4,6,
- 0,8,8,10,8,12,12,14,
- 0,16,16,18,16,20,20,22,
- 16,24,24,26,24,28,28,30,
- 0,32,32,34,32,36,36,38,
- 32,40,40,42,40,44,44,46,
- 32,48,48,50,48,52,52,54,
- 48,56,56,58,56,60,60,62,
+ 0, 0, 1, 0, 2, 0, 1, 0,
+ 3, 0, 1, 0, 2, 0, 1, 0,
+ 4, 0, 1, 0, 2, 0, 1, 0,
+ 3, 0, 1, 0, 2, 0, 1, 0,
+ 5, 0, 1, 0, 2, 0, 1, 0,
+ 3, 0, 1, 0, 2, 0, 1, 0,
+ 4, 0, 1, 0, 2, 0, 1, 0,
+ 3, 0, 1, 0, 2, 0, 1, 0,
+
+ 0, 0, 0, 2, 0, 4, 4, 6,
+ 0, 8, 8, 10, 8, 12, 12, 14,
+ 0, 16, 16, 18, 16, 20, 20, 22,
+ 16, 24, 24, 26, 24, 28, 28, 30,
+ 0, 32, 32, 34, 32, 36, 36, 38,
+ 32, 40, 40, 42, 40, 44, 44, 46,
+ 32, 48, 48, 50, 48, 52, 52, 54,
+ 48, 56, 56, 58, 56, 60, 60, 62,
};
/* Maps a trackdir to the (4-way) direction the tile is exited when following
diff --git a/yapf/yapf.h b/yapf/yapf.h
index 20a2e89ee..55b9f73ca 100644
--- a/yapf/yapf.h
+++ b/yapf/yapf.h
@@ -6,54 +6,54 @@
#include "../debug.h"
/** Finds the best path for given ship.
- @param v - the ship that needs to find a path
- @param tile - the tile to find the path from (should be next tile the ship is about to enter)
- @param enterdir - diagonal direction which the ship will enter this new tile from
- @param tracks - available tracks on the new tile (to choose from)
- @return - the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
+ * @param v the ship that needs to find a path
+ * @param tile the tile to find the path from (should be next tile the ship is about to enter)
+ * @param enterdir diagonal direction which the ship will enter this new tile from
+ * @param tracks available tracks on the new tile (to choose from)
+ * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
*/
Trackdir YapfChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks);
/** Finds the best path for given road vehicle.
- @param v - the RV that needs to find a path
- @param tile - the tile to find the path from (should be next tile the RV is about to enter)
- @param enterdir - diagonal direction which the RV will enter this new tile from
- @param tracks - available tracks on the new tile (to choose from)
- @return - the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
-*/
+ * @param v the RV that needs to find a path
+ * @param tile the tile to find the path from (should be next tile the RV is about to enter)
+ * @param enterdir diagonal direction which the RV will enter this new tile from
+ * @param tracks available tracks on the new tile (to choose from)
+ * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
+ */
Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir);
/** Finds the best path for given train.
- @param v - the train that needs to find a path
- @param tile - the tile to find the path from (should be next tile the train is about to enter)
- @param enterdir - diagonal direction which the RV will enter this new tile from
- @param tracks - available tracks on the new tile (to choose from)
- @return - the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
-*/
+ * @param v the train that needs to find a path
+ * @param tile the tile to find the path from (should be next tile the train is about to enter)
+ * @param enterdir diagonal direction which the RV will enter this new tile from
+ * @param tracks available tracks on the new tile (to choose from)
+ * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
+ */
Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs);
/** Used by RV multistop feature to find the nearest road stop that has a free slot.
- @param v - RV (its current tile will be the origin)
- @param tile - destination tile
- @return - distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found
-*/
+ * @param v RV (its current tile will be the origin)
+ * @param tile destination tile
+ * @return distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found
+ */
uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile);
/** Used when user sends RV to the nearest depot or if RV needs servicing.
- Returns the nearest depot (or NULL if depot was not found).
-*/
+ * Returns the nearest depot (or NULL if depot was not found).
+ */
Depot* YapfFindNearestRoadDepot(const Vehicle *v);
/** Used when user sends train to the nearest depot or if train needs servicing.
- @v - train that needs to go to some depot
- @max_distance - max distance (number of track tiles) from the current train position
- (used also as optimization - the pathfinder can stop path finding if max_distance
- was reached and no depot was seen)
- @reverse_penalty - penalty that should be added for the path that requires reversing the train first
- @depot_tile - receives the depot tile if depot was found
- @reversed - receives true if train needs to reversed first
- @return - the true if depot was found.
-*/
+ * @v train that needs to go to some depot
+ * @max_distance max distance (number of track tiles) from the current train position
+ * (used also as optimization - the pathfinder can stop path finding if max_distance
+ * was reached and no depot was seen)
+ * @reverse_penalty penalty that should be added for the path that requires reversing the train first
+ * @depot_tile receives the depot tile if depot was found
+ * @reversed receives true if train needs to reversed first
+ * @return the true if depot was found.
+ */
bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed);
/** Returns true if it is better to reverse the train before leaving station */
@@ -72,17 +72,17 @@ extern int _aystar_stats_closed_size;
/** Track followers. They should help whenever any new code will need to walk through
-tracks, road or water tiles (pathfinders, signal controllers, vehicle controllers).
-It is an attempt to introduce API that should simplify tasks listed above.
-If you will need to use it:
- 1. allocate/declare FollowTrack_t structure;
- 2. call FollowTrackInit() and provide vehicle (if relevant)
- 3. call one of 6 FollowTrackXxxx() APIs below
- 4. check return value (if true then continue else stop)
- 5. look at FollowTrack_t structure for the result
- 6. optionally repeat steps 3..5
- 7. in case of troubles contact KUDr
-*/
+ * tracks, road or water tiles (pathfinders, signal controllers, vehicle controllers).
+ * It is an attempt to introduce API that should simplify tasks listed above.
+ * If you will need to use it:
+ * 1. allocate/declare FollowTrack_t structure;
+ * 2. call FollowTrackInit() and provide vehicle (if relevant)
+ * 3. call one of 6 FollowTrackXxxx() APIs below
+ * 4. check return value (if true then continue else stop)
+ * 5. look at FollowTrack_t structure for the result
+ * 6. optionally repeat steps 3..5
+ * 7. in case of troubles contact KUDr
+ */
/** Base struct for track followers. */
typedef struct FollowTrack_t
diff --git a/yapf/yapf_base.hpp b/yapf/yapf_base.hpp
index 96893b39d..98ca6ba9c 100644
--- a/yapf/yapf_base.hpp
+++ b/yapf/yapf_base.hpp
@@ -14,34 +14,34 @@ EXTERN_C_END
extern int _total_pf_time_us;
/** CYapfBaseT - A-star type path finder base class.
- Derive your own pathfinder from it. You must provide the following template argument:
- Types - used as collection of local types used in pathfinder
-
- Requirements for the Types struct:
- ----------------------------------
- The following types must be defined in the 'Types' argument:
- - Types::Tpf - your pathfinder derived from CYapfBaseT
- - Types::NodeList - open/closed node list (look at CNodeList_HashTableT)
- NodeList needs to have defined local type Titem - defines the pathfinder node type.
- Node needs to define local type Key - the node key in the collection ()
-
- For node list you can use template class CNodeList_HashTableT, for which
- you need to declare only your node type. Look at test_yapf.h for an example.
-
-
- Requrements to your pathfinder class derived from CYapfBaseT:
- -------------------------------------------------------------
- Your pathfinder derived class needs to implement following methods:
- FORCEINLINE void PfSetStartupNodes()
- FORCEINLINE void PfFollowNode(Node& org)
- FORCEINLINE bool PfCalcCost(Node& n)
- FORCEINLINE bool PfCalcEstimate(Node& n)
- FORCEINLINE bool PfDetectDestination(Node& n)
-
- For more details about those methods, look at the end of CYapfBaseT
- declaration. There are some examples. For another example look at
- test_yapf.h (part or unittest project).
-*/
+ * Derive your own pathfinder from it. You must provide the following template argument:
+ * Types - used as collection of local types used in pathfinder
+ *
+ * Requirements for the Types struct:
+ * ----------------------------------
+ * The following types must be defined in the 'Types' argument:
+ * - Types::Tpf - your pathfinder derived from CYapfBaseT
+ * - Types::NodeList - open/closed node list (look at CNodeList_HashTableT)
+ * NodeList needs to have defined local type Titem - defines the pathfinder node type.
+ * Node needs to define local type Key - the node key in the collection ()
+ *
+ * For node list you can use template class CNodeList_HashTableT, for which
+ * you need to declare only your node type. Look at test_yapf.h for an example.
+ *
+ *
+ * Requrements to your pathfinder class derived from CYapfBaseT:
+ * -------------------------------------------------------------
+ * Your pathfinder derived class needs to implement following methods:
+ * FORCEINLINE void PfSetStartupNodes()
+ * FORCEINLINE void PfFollowNode(Node& org)
+ * FORCEINLINE bool PfCalcCost(Node& n)
+ * FORCEINLINE bool PfCalcEstimate(Node& n)
+ * FORCEINLINE bool PfDetectDestination(Node& n)
+ *
+ * For more details about those methods, look at the end of CYapfBaseT
+ * declaration. There are some examples. For another example look at
+ * test_yapf.h (part or unittest project).
+ */
template <class Types>
class CYapfBaseT {
public:
@@ -105,12 +105,12 @@ public:
}
/** Main pathfinder routine:
- - set startup node(s)
- - main loop that stops if:
- - 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 */
+ * - set startup node(s)
+ * - main loop that stops if:
+ * - 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 */
inline bool FindPath(const Vehicle* v)
{
m_veh = v;
@@ -160,16 +160,16 @@ public:
}
/** If path was found return the best node that has reached the destination. Otherwise
- return the best visited node (which was nearest to the destination).
- */
+ * return the best visited node (which was nearest to the destination).
+ */
FORCEINLINE Node& GetBestNode()
{
return (m_pBestDestNode != NULL) ? *m_pBestDestNode : *m_pBestIntermediateNode;
}
/** Calls NodeList::CreateNewNode() - allocates new node that can be filled and used
- as argument for AddStartupNode() or AddNewNode()
- */
+ * as argument for AddStartupNode() or AddNewNode()
+ */
FORCEINLINE Node& CreateNewNode()
{
Node& node = *m_nodes.CreateNewNode();
@@ -203,7 +203,7 @@ 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)
{
// evaluate the node
diff --git a/yapf/yapf_common.hpp b/yapf/yapf_common.hpp
index e9e827323..869bc820c 100644
--- a/yapf/yapf_common.hpp
+++ b/yapf/yapf_common.hpp
@@ -129,7 +129,7 @@ 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)
{
int dx = abs(TileX(n.GetTile()) - TileX(m_destTile));
@@ -144,9 +144,9 @@ 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 */
+ * 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 */
template <class Ttypes>
class CYapfT
: public Ttypes::PfBase ///< Instance of CYapfBaseT - main YAPF loop and support base class
diff --git a/yapf/yapf_costcache.hpp b/yapf/yapf_costcache.hpp
index 5ad6f8cdc..e1f635e68 100644
--- a/yapf/yapf_costcache.hpp
+++ b/yapf/yapf_costcache.hpp
@@ -4,9 +4,9 @@
/** CYapfSegmentCostCacheNoneT - the formal only yapf cost cache provider that implements
-PfNodeCacheFetch() and PfNodeCacheFlush() callbacks. Used when nodes don't have CachedData
-defined (they don't count with any segment cost caching).
-*/
+ * PfNodeCacheFetch() and PfNodeCacheFlush() callbacks. Used when nodes don't have CachedData
+ * defined (they don't count with any segment cost caching).
+ */
template <class Types>
class CYapfSegmentCostCacheNoneT
{
@@ -15,14 +15,14 @@ public:
typedef typename Types::NodeList::Titem Node; ///< this will be our node type
/** 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;
};
/** 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)
{
};
@@ -30,9 +30,9 @@ public:
/** CYapfSegmentCostCacheLocalT - the yapf cost cache provider that implements fake segment
-cost caching functionality for yapf. Used when node needs caching, but you don't want to
-cache the segment costs.
-*/
+ * cost caching functionality for yapf. Used when node needs caching, but you don't want to
+ * cache the segment costs.
+ */
template <class Types>
class CYapfSegmentCostCacheLocalT
{
@@ -52,7 +52,7 @@ 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());
@@ -61,7 +61,7 @@ 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)
{
};
@@ -69,10 +69,10 @@ public:
/** Base class for segment cost cache providers. Contains global counter
-* 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. */
+ * 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. */
struct CSegmentCostCacheBase
{
static int s_rail_change_counter;
@@ -82,13 +82,13 @@ struct CSegmentCostCacheBase
/** CSegmentCostCacheT - template class providing hash-map and storage (heap)
- of Tsegment structures. Each rail node contains pointer to the segment
- that contains cached (or non-cached) segment cost information. Nodes can
- differ by key type, but they use the same segment type. Segment key should
- 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 */
+ * of Tsegment structures. Each rail node contains pointer to the segment
+ * that contains cached (or non-cached) segment cost information. Nodes can
+ * differ by key type, but they use the same segment type. Segment key should
+ * 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 */
template <class Tsegment>
struct CSegmentCostCacheT
: public CSegmentCostCacheBase
@@ -119,8 +119,8 @@ struct CSegmentCostCacheT
};
/** CYapfSegmentCostCacheGlobalT - the yapf cost cache provider that adds the segment cost
- caching functionality to yapf. Using this class as base of your will provide the global
- segment cost caching services for your Nodes.
+ * caching functionality to yapf. Using this class as base of your will provide the global
+ * segment cost caching services for your Nodes.
*/
template <class Types>
class CYapfSegmentCostCacheGlobalT
@@ -173,7 +173,7 @@ 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)) {
@@ -187,7 +187,7 @@ 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/yapf/yapf_costrail.hpp b/yapf/yapf_costrail.hpp
index b87793c60..c19e296d8 100644
--- a/yapf/yapf_costrail.hpp
+++ b/yapf/yapf_costrail.hpp
@@ -160,8 +160,8 @@ public:
FORCEINLINE void SetMaxCost(int max_cost) {m_max_cost = max_cost;}
/** 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 */
+ * Calculates only the cost of given node, adds it to the parent node cost
+ * and stores the result into Node::m_cost member */
FORCEINLINE bool PfCalcCost(Node& n)
{
assert(!n.flags_u.flags_s.m_targed_seen);
diff --git a/yapf/yapf_destrail.hpp b/yapf/yapf_destrail.hpp
index f22166840..9a5bd0536 100644
--- a/yapf/yapf_destrail.hpp
+++ b/yapf/yapf_destrail.hpp
@@ -46,7 +46,7 @@ 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;
@@ -118,7 +118,7 @@ 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 int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
diff --git a/yapf/yapf_rail.cpp b/yapf/yapf_rail.cpp
index 72cfe3fad..c830d2b44 100644
--- a/yapf/yapf_rail.cpp
+++ b/yapf/yapf_rail.cpp
@@ -28,8 +28,8 @@ protected:
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) */
+ * reachable trackdir on the new tile creates new node, initializes it
+ * and adds it to the open list by calling Yapf().AddNewNode(n) */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F(Yapf().GetVehicle());
@@ -91,8 +91,8 @@ protected:
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) */
+ * reachable trackdir on the new tile creates new node, initializes it
+ * 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/yapf/yapf_road.cpp b/yapf/yapf_road.cpp
index 1b9000f13..2a4680b8c 100644
--- a/yapf/yapf_road.cpp
+++ b/yapf/yapf_road.cpp
@@ -64,8 +64,8 @@ protected:
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 */
+ * Calculates only the cost of given node, adds it to the parent node cost
+ * and stores the result into Node::m_cost member */
FORCEINLINE bool PfCalcCost(Node& n)
{
int segment_cost = 0;
@@ -144,7 +144,7 @@ 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;
@@ -186,7 +186,7 @@ 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 int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
@@ -231,8 +231,8 @@ protected:
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) */
+ * reachable trackdir on the new tile creates new node, initializes it
+ * 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/yapf/yapf_settings.h b/yapf/yapf_settings.h
index 724196ac2..77c4f2da4 100644
--- a/yapf/yapf_settings.h
+++ b/yapf/yapf_settings.h
@@ -7,15 +7,15 @@
# ifndef YS_DEF
/*
-* if YS_DEF is not defined, we will only do following declaration:
-* typedef struct YapfSettings {
-* bool disable_node_optimization;
-* uint32 max_search_nodes;
-* .... all other yapf related settings ...
-* } YapfSettings;
-*
-* otherwise we will just expand YS_DEF_xx macros and then #undef them
-*/
+ * if YS_DEF is not defined, we will only do following declaration:
+ * typedef struct YapfSettings {
+ * bool disable_node_optimization;
+ * uint32 max_search_nodes;
+ * .... all other yapf related settings ...
+ * } YapfSettings;
+ *
+ * otherwise we will just expand YS_DEF_xx macros and then #undef them
+ */
# define YS_DEF_BEGIN typedef struct YapfSettings {
# define YS_DEF(type, name) type name;
# define YS_DEF_END } YapfSettings;
diff --git a/yapf/yapf_ship.cpp b/yapf/yapf_ship.cpp
index 0682cd45f..728c41cd9 100644
--- a/yapf/yapf_ship.cpp
+++ b/yapf/yapf_ship.cpp
@@ -20,8 +20,8 @@ protected:
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) */
+ * reachable trackdir on the new tile creates new node, initializes it
+ * and adds it to the open list by calling Yapf().AddNewNode(n) */
inline void PfFollowNode(Node& old_node)
{
TrackFollower F;
@@ -95,8 +95,8 @@ protected:
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 */
+ * Calculates only the cost of given node, adds it to the parent node cost
+ * and stores the result into Node::m_cost member */
FORCEINLINE bool PfCalcCost(Node& n)
{
// base tile cost depending on distance
@@ -110,8 +110,8 @@ public:
};
/** Config struct of YAPF for ships.
- Defines all 6 base YAPF modules as classes providing services for CYapfBaseT.
-*/
+ * Defines all 6 base YAPF modules as classes providing services for CYapfBaseT.
+ */
template <class Tpf_, class Ttrack_follower, class Tnode_list>
struct CYapfShip_TypesT
{