From ed48b38619492a4018ac014d203718db689f69b2 Mon Sep 17 00:00:00 2001 From: KUDr Date: Mon, 29 May 2006 18:39:42 +0000 Subject: (svn r5018) [YAPF] Added some comments to YAPF implementation. --- yapf/yapf_rail.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'yapf/yapf_rail.cpp') 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 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(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 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(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) -- cgit v1.2.3-70-g09d2