diff options
author | KUDr <kudr@openttd.org> | 2006-05-29 18:39:42 +0000 |
---|---|---|
committer | KUDr <kudr@openttd.org> | 2006-05-29 18:39:42 +0000 |
commit | ed48b38619492a4018ac014d203718db689f69b2 (patch) | |
tree | cca7f9d507723ce078f410649f6ba598ccdb0523 /yapf/yapf_rail.cpp | |
parent | 301f4ac856088ac32f89b791479fbb0dfb4f911b (diff) | |
download | openttd-ed48b38619492a4018ac014d203718db689f69b2.tar.xz |
(svn r5018) [YAPF] Added some comments to YAPF implementation.
Diffstat (limited to 'yapf/yapf_rail.cpp')
-rw-r--r-- | yapf/yapf_rail.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/yapf/yapf_rail.cpp b/yapf/yapf_rail.cpp index 67d3d781f..7f0b11e27 100644 --- a/yapf/yapf_rail.cpp +++ b/yapf/yapf_rail.cpp @@ -17,15 +17,19 @@ template <class Types> class CYapfFollowAnyDepotRailT { public: - typedef typename Types::Tpf Tpf; + typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; - typedef typename Types::NodeList::Titem Node; ///< this will be our node type - typedef typename Node::Key Key; ///< key to hash tables + typedef typename Types::NodeList::Titem Node; ///< this will be our node type + typedef typename Node::Key Key; ///< key to hash tables protected: + /// to access inherited path finder FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);} 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) */ inline void PfFollowNode(Node& old_node) { TrackFollower F(Yapf().GetVehicle()); @@ -33,6 +37,7 @@ public: Yapf().AddMultipleNodes(&old_node, F.m_new_tile, F.m_new_td_bits); } + /// return debug report character to identify the transportation type FORCEINLINE char TransportTypeChar() const {return 't';} static bool stFindNearestDepotTwoWay(Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed) @@ -75,15 +80,19 @@ template <class Types> class CYapfFollowRailT { public: - typedef typename Types::Tpf Tpf; + typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; - typedef typename Types::NodeList::Titem Node; ///< this will be our node type - typedef typename Node::Key Key; ///< key to hash tables + typedef typename Types::NodeList::Titem Node; ///< this will be our node type + typedef typename Node::Key Key; ///< key to hash tables protected: + /// to access inherited path finder FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);} 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) */ inline void PfFollowNode(Node& old_node) { TrackFollower F(Yapf().GetVehicle()); @@ -91,6 +100,7 @@ public: Yapf().AddMultipleNodes(&old_node, F.m_new_tile, F.m_new_td_bits); } + /// return debug report character to identify the transportation type FORCEINLINE char TransportTypeChar() const {return 't';} static Trackdir stChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs) |