changeset 11260:6b0149b64909 draft

(svn r15609) -Fix: Code style...
author peter1138 <peter1138@openttd.org>
date Wed, 04 Mar 2009 08:02:16 +0000
parents 9b1e7de49fbf
children 5a50ba45cf24
files src/yapf/nodelist.hpp src/yapf/yapf.hpp src/yapf/yapf_base.hpp src/yapf/yapf_common.hpp src/yapf/yapf_costbase.hpp src/yapf/yapf_costcache.hpp src/yapf/yapf_costrail.hpp src/yapf/yapf_destrail.hpp src/yapf/yapf_node_rail.hpp src/yapf/yapf_node_road.hpp src/yapf/yapf_rail.cpp src/yapf/yapf_road.cpp src/yapf/yapf_ship.cpp
diffstat 13 files changed, 300 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/yapf/nodelist.hpp
+++ b/src/yapf/nodelist.hpp
@@ -46,28 +46,41 @@
 	{
 		m_new_node = NULL;
 	}
+
 	/** destructor */
 	~CNodeList_HashTableT()
 	{
 	}
+
 	/** return number of open nodes */
-	FORCEINLINE int OpenCount() {return m_open.Count();}
+	FORCEINLINE int OpenCount()
+	{
+		return m_open.Count();
+	}
+
 	/** return number of closed nodes */
-	FORCEINLINE int ClosedCount() {return m_closed.Count();}
+	FORCEINLINE int ClosedCount()
+	{
+		return m_closed.Count();
+	}
+
 	/** allocate new data item from m_arr */
 	FORCEINLINE Titem_ *CreateNewNode()
 	{
 		if (m_new_node == NULL) m_new_node = &m_arr.Add();
 		return m_new_node;
 	}
+
 	/** notify the nodelist, that we don't want to discard the given node */
 	FORCEINLINE void FoundBestNode(Titem_& item)
 	{
 		// for now it is enough to invalidate m_new_node if it is our given node
-		if (&item == m_new_node)
+		if (&item == m_new_node) {
 			m_new_node = NULL;
+		}
 		// TODO: do we need to store best nodes found in some extra list/array? Probably not now.
 	}
+
 	/** insert given item as open node (into m_open and m_open_queue) */
 	FORCEINLINE void InsertOpenNode(Titem_& item)
 	{
@@ -76,9 +89,11 @@
 		// TODO: check if m_open_queue is not full
 		assert(!m_open_queue.IsFull());
 		m_open_queue.Push(item);
-		if (&item == m_new_node)
+		if (&item == m_new_node) {
 			m_new_node = NULL;
+		}
 	}
+
 	/** return the best open node */
 	FORCEINLINE Titem_ *GetBestOpenNode()
 	{
@@ -88,6 +103,7 @@
 		}
 		return NULL;
 	}
+
 	/** remove and return the best open node */
 	FORCEINLINE Titem_ *PopBestOpenNode()
 	{
@@ -98,12 +114,14 @@
 		}
 		return NULL;
 	}
+
 	/** return the open node specified by a key or NULL if not found */
 	FORCEINLINE Titem_ *FindOpenNode(const Key& key)
 	{
 		Titem_ *item = m_open.Find(key);
 		return item;
 	}
+
 	/** remove and return the open node specified by a key */
 	FORCEINLINE Titem_& PopOpenNode(const Key& key)
 	{
@@ -112,12 +130,14 @@
 		m_open_queue.RemoveByIdx(idxPop);
 		return item;
 	}
+
 	/** close node */
 	FORCEINLINE void InsertClosedNode(Titem_& item)
 	{
 		assert(m_open.Find(item.GetKey()) == NULL);
 		m_closed.Push(item);
 	}
+
 	/** return the closed node specified by a key or NULL if not found */
 	FORCEINLINE Titem_ *FindClosedNode(const Key& key)
 	{
--- a/src/yapf/yapf.hpp
+++ b/src/yapf/yapf.hpp
@@ -41,21 +41,53 @@
 
 	CPerformanceTimer() : m_start(0), m_acc(0) {}
 
-	FORCEINLINE void Start() {m_start = QueryTime();}
-	FORCEINLINE void Stop() {m_acc += QueryTime() - m_start;}
-	FORCEINLINE int Get(int64 coef) {return (int)(m_acc * coef / QueryFrequency());}
+	FORCEINLINE void Start()
+	{
+		m_start = QueryTime();
+	}
+
+	FORCEINLINE void Stop()
+	{
+		m_acc += QueryTime() - m_start;
+	}
 
-	FORCEINLINE int64 QueryTime() {return ottd_rdtsc();}
-	FORCEINLINE int64 QueryFrequency() {return ((int64)2200 * 1000000);}
+	FORCEINLINE int Get(int64 coef)
+	{
+		return (int)(m_acc * coef / QueryFrequency());
+	}
+
+	FORCEINLINE int64 QueryTime()
+	{
+		return ottd_rdtsc();
+	}
+
+	FORCEINLINE int64 QueryFrequency()
+	{
+		return ((int64)2200 * 1000000);
+	}
 };
 
 struct CPerfStartReal
 {
 	CPerformanceTimer *m_pperf;
 
-	FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
-	FORCEINLINE ~CPerfStartReal() {Stop();}
-	FORCEINLINE void Stop() {if (m_pperf != NULL) {m_pperf->Stop(); m_pperf = NULL;}}
+	FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf)
+	{
+		if (m_pperf != NULL) m_pperf->Start();
+	}
+
+	FORCEINLINE ~CPerfStartReal()
+	{
+		Stop();
+	}
+
+	FORCEINLINE void Stop()
+	{
+		if (m_pperf != NULL) {
+			m_pperf->Stop();
+			m_pperf = NULL;
+		}
+	}
 };
 
 struct CPerfStartFake
--- a/src/yapf/yapf_base.hpp
+++ b/src/yapf/yapf_base.hpp
@@ -88,7 +88,10 @@
 
 protected:
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/// return current settings (can be custom - company based - but later)
@@ -118,12 +121,14 @@
 		while (true) {
 			m_num_steps++;
 			Node *n = m_nodes.GetBestOpenNode();
-			if (n == NULL)
+			if (n == NULL) {
 				break;
+			}
 
 			// if the best open node was worse than the best path found, we can finish
-			if (m_pBestDestNode != NULL && m_pBestDestNode->GetCost() < n->GetCostEstimate())
+			if (m_pBestDestNode != NULL && m_pBestDestNode->GetCost() < n->GetCostEstimate()) {
 				break;
+			}
 
 			Yapf().PfFollowNode(*n);
 			if (m_max_search_nodes == 0 || m_nodes.ClosedCount() < m_max_search_nodes) {
@@ -281,7 +286,10 @@
 		m_nodes.InsertOpenNode(n);
 	}
 
-	const Vehicle * GetVehicle() const {return m_veh;}
+	const Vehicle * GetVehicle() const
+	{
+		return m_veh;
+	}
 
 	void DumpBase(DumpTarget &dmp) const
 	{
--- a/src/yapf/yapf_common.hpp
+++ b/src/yapf/yapf_common.hpp
@@ -19,7 +19,10 @@
 	TrackdirBits m_orgTrackdirs;                  ///< origin trackdir mask
 
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/// Set origin tile / trackdir mask
@@ -60,7 +63,10 @@
 	bool        m_treat_first_red_two_way_signal_as_eol; ///< in some cases (leaving station) we need to handle first two-way signal differently
 
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/// set origin (tiles, trackdirs, etc.)
@@ -120,7 +126,10 @@
 
 protected:
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/// Called by YAPF to detect if node ends in the desired destination
--- a/src/yapf/yapf_costbase.hpp
+++ b/src/yapf/yapf_costbase.hpp
@@ -11,7 +11,7 @@
 		if (IsDiagonalTrackdir(td)) {
 			if (IsBridgeTile(tile)) {
 				// it is bridge ramp, check if we are entering the bridge
-				if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
+				if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are leaving it, no penalty
 				// we are entering the bridge
 				Slope tile_slope = GetTileSlope(tile, NULL);
 				Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
--- a/src/yapf/yapf_costcache.hpp
+++ b/src/yapf/yapf_costcache.hpp
@@ -23,13 +23,13 @@
 	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. */
 	FORCEINLINE void PfNodeCacheFlush(Node& n)
 	{
-	};
+	}
 };
 
 
@@ -52,7 +52,10 @@
 	LocalCache      m_local_cache;
 
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/** Called by YAPF to attach cached or local segment cost data to the given node.
@@ -62,13 +65,13 @@
 		CacheKey key(n.GetKey());
 		Yapf().ConnectNodeToCachedData(n, *new (&m_local_cache.AddNC()) CachedData(key));
 		return false;
-	};
+	}
 
 	/** Called by YAPF to flush the cached segment cost data back into cache storage.
 	 *  Current cache implementation doesn't use that. */
 	FORCEINLINE void PfNodeCacheFlush(Node& n)
 	{
-	};
+	}
 };
 
 
@@ -81,7 +84,10 @@
 {
 	static int   s_rail_change_counter;
 
-	static void NotifyTrackLayoutChange(TileIndex tile, Track track) {s_rail_change_counter++;}
+	static void NotifyTrackLayoutChange(TileIndex tile, Track track)
+	{
+		s_rail_change_counter++;
+	}
 };
 
 
@@ -109,7 +115,11 @@
 	FORCEINLINE CSegmentCostCacheT() {}
 
 	/** flush (clear) the cache */
-	FORCEINLINE void Flush() {m_map.Clear(); m_heap.Clear();};
+	FORCEINLINE void Flush()
+	{
+		m_map.Clear();
+		m_heap.Clear();
+	}
 
 	FORCEINLINE Tsegment& Get(Key& key, bool *found)
 	{
@@ -148,7 +158,10 @@
 	FORCEINLINE CYapfSegmentCostCacheGlobalT() : m_global_cache(stGetGlobalCache()) {};
 
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 	FORCEINLINE static Cache& stGetGlobalCache()
 	{
@@ -184,17 +197,13 @@
 		CachedData& item = m_global_cache.Get(key, &found);
 		Yapf().ConnectNodeToCachedData(n, item);
 		return found;
-	};
+	}
 
 	/** Called by YAPF to flush the cached segment cost data back into cache storage.
 	 *  Current cache implementation doesn't use that. */
 	FORCEINLINE void PfNodeCacheFlush(Node& n)
 	{
-	};
-
+	}
 };
 
-
-
-
 #endif /* YAPF_COSTCACHE_HPP */
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -74,12 +74,16 @@
 		int p1 = Yapf().PfGetSettings().rail_look_ahead_signal_p1;
 		int p2 = Yapf().PfGetSettings().rail_look_ahead_signal_p2;
 		int *pen = m_sig_look_ahead_costs.GrowSizeNC(Yapf().PfGetSettings().rail_look_ahead_max_signals);
-		for (uint i = 0; i < Yapf().PfGetSettings().rail_look_ahead_max_signals; i++)
+		for (uint i = 0; i < Yapf().PfGetSettings().rail_look_ahead_max_signals; i++) {
 			pen[i] = p0 + i * (p1 + i * p2);
+		}
 	}
 
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	FORCEINLINE int SlopeCost(TileIndex tile, Trackdir td)
@@ -125,8 +129,9 @@
 			switch (GetTileType(tile)) {
 				case MP_ROAD:
 					/* Increase the cost for level crossings */
-					if (IsLevelCrossing(tile))
+					if (IsLevelCrossing(tile)) {
 						cost += Yapf().PfGetSettings().rail_crossing_penalty;
+					}
 					break;
 
 				default:
@@ -215,7 +220,7 @@
 								case SIGTYPE_NORMAL:
 								case SIGTYPE_ENTRY:  cost += Yapf().PfGetSettings().rail_firstred_penalty; break;
 								default: break;
-							};
+							}
 						}
 					}
 
@@ -251,9 +256,10 @@
 	}
 
 public:
-	FORCEINLINE void SetMaxCost(int max_cost) {m_max_cost = max_cost;}
-
-
+	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
@@ -412,10 +418,12 @@
 			{
 				int min_speed = 0;
 				int max_speed = tf->GetSpeedLimit(&min_speed);
-				if (max_speed < v->max_speed)
+				if (max_speed < v->max_speed) {
 					extra_cost += YAPF_TILE_LENGTH * (v->max_speed - max_speed) * (4 + tf->m_tiles_skipped) / v->max_speed;
-				if (min_speed > v->max_speed)
+				}
+				if (min_speed > v->max_speed) {
 					extra_cost += YAPF_TILE_LENGTH * (min_speed - v->max_speed);
+				}
 			}
 
 			/* Finish if we already exceeded the maximum path cost (i.e. when
@@ -569,6 +577,4 @@
 	}
 };
 
-
-
 #endif /* YAPF_COSTRAIL_HPP */
--- a/src/yapf/yapf_destrail.hpp
+++ b/src/yapf/yapf_destrail.hpp
@@ -38,7 +38,10 @@
 	typedef typename Node::Key Key;               ///< key to hash tables
 
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 	/// Called by YAPF to detect if node ends in the desired destination
 	FORCEINLINE bool PfDetectDestination(Node& n)
@@ -73,7 +76,10 @@
 	typedef typename Types::TrackFollower TrackFollower; ///< TrackFollower. Need to typedef for gcc 2.95
 
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 	/// Called by YAPF to detect if node ends in the desired destination
 	FORCEINLINE bool PfDetectDestination(Node& n)
@@ -113,7 +119,10 @@
 	StationID    m_dest_station_id;
 
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	void SetDestination(const Vehicle *v)
@@ -200,5 +209,4 @@
 	}
 };
 
-
 #endif /* YAPF_DESTRAIL_HPP */
--- a/src/yapf/yapf_node_rail.hpp
+++ b/src/yapf/yapf_node_rail.hpp
@@ -11,15 +11,41 @@
 	uint32    m_value;
 
 	FORCEINLINE CYapfRailSegmentKey(const CYapfRailSegmentKey& src) : m_value(src.m_value) {}
-	FORCEINLINE CYapfRailSegmentKey(const CYapfNodeKeyTrackDir& node_key) {Set(node_key);}
+
+	FORCEINLINE CYapfRailSegmentKey(const CYapfNodeKeyTrackDir& node_key)
+	{
+		Set(node_key);
+	}
 
-	FORCEINLINE void Set(const CYapfRailSegmentKey& src) {m_value = src.m_value;}
-	FORCEINLINE void Set(const CYapfNodeKeyTrackDir& node_key) {m_value = (((int)node_key.m_tile) << 4) | node_key.m_td;}
+	FORCEINLINE void Set(const CYapfRailSegmentKey& src)
+	{
+		m_value = src.m_value;
+	}
+
+	FORCEINLINE void Set(const CYapfNodeKeyTrackDir& node_key)
+	{
+		m_value = (((int)node_key.m_tile) << 4) | node_key.m_td;
+	}
 
-	FORCEINLINE int32 CalcHash() const {return m_value;}
-	FORCEINLINE TileIndex GetTile() const {return (TileIndex)(m_value >> 4);}
-	FORCEINLINE Trackdir GetTrackdir() const {return (Trackdir)(m_value & 0x0F);}
-	FORCEINLINE bool operator == (const CYapfRailSegmentKey& other) const {return m_value == other.m_value;}
+	FORCEINLINE int32 CalcHash() const
+	{
+		return m_value;
+	}
+
+	FORCEINLINE TileIndex GetTile() const
+	{
+		return (TileIndex)(m_value >> 4);
+	}
+
+	FORCEINLINE Trackdir GetTrackdir() const
+	{
+		return (Trackdir)(m_value & 0x0F);
+	}
+
+	FORCEINLINE bool operator == (const CYapfRailSegmentKey& other) const
+	{
+		return m_value == other.m_value;
+	}
 
 	void Dump(DumpTarget &dmp) const
 	{
@@ -122,10 +148,25 @@
 		, m_hash_next(NULL)
 	{}
 
-	FORCEINLINE const Key& GetKey() const {return m_key;}
-	FORCEINLINE TileIndex GetTile() const {return m_key.GetTile();}
-	FORCEINLINE CYapfRailSegment *GetHashNext() {return m_hash_next;}
-	FORCEINLINE void SetHashNext(CYapfRailSegment *next) {m_hash_next = next;}
+	FORCEINLINE const Key& GetKey() const
+	{
+		return m_key;
+	}
+
+	FORCEINLINE TileIndex GetTile() const
+	{
+		return m_key.GetTile();
+	}
+
+	FORCEINLINE CYapfRailSegment *GetHashNext()
+	{
+		return m_hash_next;
+	}
+
+	FORCEINLINE void SetHashNext(CYapfRailSegment *next)
+	{
+		m_hash_next = next;
+	}
 
 	void Dump(DumpTarget &dmp) const
 	{
@@ -175,9 +216,24 @@
 		flags_u.flags_s.m_choice_seen |= is_choice;
 	}
 
-	FORCEINLINE TileIndex GetLastTile() const {assert(m_segment != NULL); return m_segment->m_last_tile;}
-	FORCEINLINE Trackdir GetLastTrackdir() const {assert(m_segment != NULL); return m_segment->m_last_td;}
-	FORCEINLINE void SetLastTileTrackdir(TileIndex tile, Trackdir td) {assert(m_segment != NULL); m_segment->m_last_tile = tile; m_segment->m_last_td = td;}
+	FORCEINLINE TileIndex GetLastTile() const
+	{
+		assert(m_segment != NULL);
+		return m_segment->m_last_tile;
+	}
+
+	FORCEINLINE Trackdir GetLastTrackdir() const
+	{
+		assert(m_segment != NULL);
+		return m_segment->m_last_td;
+	}
+
+	FORCEINLINE void SetLastTileTrackdir(TileIndex tile, Trackdir td)
+	{
+		assert(m_segment != NULL);
+		m_segment->m_last_tile = tile;
+		m_segment->m_last_td = td;
+	}
 
 	template <class Tbase, class Tfunc, class Tpf>
 	bool IterateTiles(const Vehicle *v, Tpf &yapf, Tbase &obj, bool (Tfunc::*func)(TileIndex, Trackdir)) const
@@ -218,6 +274,4 @@
 typedef CNodeList_HashTableT<CYapfRailNodeExitDir , 10, 12> CRailNodeListExitDir;
 typedef CNodeList_HashTableT<CYapfRailNodeTrackDir, 12, 16> CRailNodeListTrackDir;
 
-
-
 #endif /* YAPF_NODE_RAIL_HPP */
--- a/src/yapf/yapf_node_road.hpp
+++ b/src/yapf/yapf_node_road.hpp
@@ -5,8 +5,6 @@
 #ifndef  YAPF_NODE_ROAD_HPP
 #define  YAPF_NODE_ROAD_HPP
 
-
-
 /** Yapf Node for road YAPF */
 template <class Tkey_>
 struct CYapfRoadNodeT
@@ -33,6 +31,4 @@
 typedef CNodeList_HashTableT<CYapfRoadNodeExitDir , 8, 12> CRoadNodeListExitDir;
 typedef CNodeList_HashTableT<CYapfRoadNodeTrackDir, 10, 14> CRoadNodeListTrackDir;
 
-
-
 #endif /* YAPF_NODE_ROAD_HPP */
--- a/src/yapf/yapf_rail.cpp
+++ b/src/yapf/yapf_rail.cpp
@@ -15,8 +15,6 @@
 
 int _total_pf_time_us = 0;
 
-
-
 template <class Types>
 class CYapfReserveTrack
 {
@@ -27,7 +25,10 @@
 
 protected:
 	/// to access inherited pathfinder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 private:
 	TileIndex m_res_dest;         ///< The reservation target tile
@@ -171,7 +172,10 @@
 
 protected:
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/** Called by YAPF to move from the given node to the next tile. For each
@@ -180,12 +184,16 @@
 	inline void PfFollowNode(Node& old_node)
 	{
 		TrackFollower F(Yapf().GetVehicle());
-		if (F.Follow(old_node.GetLastTile(), old_node.GetLastTrackdir()))
+		if (F.Follow(old_node.GetLastTile(), old_node.GetLastTrackdir())) {
 			Yapf().AddMultipleNodes(&old_node, F);
+		}
 	}
 
 	/// return debug report character to identify the transportation type
-	FORCEINLINE char TransportTypeChar() const {return 't';}
+	FORCEINLINE char TransportTypeChar() const
+	{
+		return 't';
+	}
 
 	static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed)
 	{
@@ -247,7 +255,10 @@
 
 protected:
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/** Called by YAPF to move from the given node to the next tile. For each
@@ -256,12 +267,16 @@
 	inline void PfFollowNode(Node& old_node)
 	{
 		TrackFollower F(Yapf().GetVehicle(), Yapf().GetCompatibleRailTypes());
-		if (F.Follow(old_node.GetLastTile(), old_node.GetLastTrackdir()) && F.MaskReservedTracks())
+		if (F.Follow(old_node.GetLastTile(), old_node.GetLastTrackdir()) && F.MaskReservedTracks()) {
 			Yapf().AddMultipleNodes(&old_node, F);
+		}
 	}
 
 	/** Return debug report character to identify the transportation type */
-	FORCEINLINE char TransportTypeChar() const {return 't';}
+	FORCEINLINE char TransportTypeChar() const
+	{
+		return 't';
+	}
 
 	static bool stFindNearestSafeTile(const Vehicle *v, TileIndex t1, Trackdir td, bool override_railtype)
 	{
@@ -329,7 +344,10 @@
 
 protected:
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/** Called by YAPF to move from the given node to the next tile. For each
@@ -338,12 +356,16 @@
 	inline void PfFollowNode(Node& old_node)
 	{
 		TrackFollower F(Yapf().GetVehicle());
-		if (F.Follow(old_node.GetLastTile(), old_node.GetLastTrackdir()))
+		if (F.Follow(old_node.GetLastTile(), old_node.GetLastTrackdir())) {
 			Yapf().AddMultipleNodes(&old_node, F);
+		}
 	}
 
 	/// return debug report character to identify the transportation type
-	FORCEINLINE char TransportTypeChar() const {return 't';}
+	FORCEINLINE char TransportTypeChar() const
+	{
+		return 't';
+	}
 
 	static Trackdir stChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool reserve_track, PBSTileInfo *target)
 	{
@@ -600,4 +622,7 @@
 /** if any track changes, this counter is incremented - that will invalidate segment cost cache */
 int CSegmentCostCacheBase::s_rail_change_counter = 0;
 
-void YapfNotifyTrackLayoutChange(TileIndex tile, Track track) {CSegmentCostCacheBase::NotifyTrackLayoutChange(tile, track);}
+void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
+{
+	CSegmentCostCacheBase::NotifyTrackLayoutChange(tile, track);
+}
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -20,7 +20,10 @@
 
 protected:
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 	int SlopeCost(TileIndex tile, TileIndex next_tile, Trackdir trackdir)
 	{
@@ -51,12 +54,15 @@
 			switch (GetTileType(tile)) {
 				case MP_ROAD:
 					/* Increase the cost for level crossings */
-					if (IsLevelCrossing(tile))
+					if (IsLevelCrossing(tile)) {
 						cost += Yapf().PfGetSettings().road_crossing_penalty;
+					}
 					break;
+
 				case MP_STATION:
-					if (IsDriveThroughStopTile(tile))
+					if (IsDriveThroughStopTile(tile)) {
 						cost += Yapf().PfGetSettings().road_stop_penalty;
+					}
 					break;
 
 				default:
@@ -144,7 +150,10 @@
 	typedef typename Node::Key Key;                      ///< key to hash tables
 
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 	/// Called by YAPF to detect if node ends in the desired destination
 	FORCEINLINE bool PfDetectDestination(Node& n)
@@ -190,7 +199,10 @@
 
 protected:
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/// Called by YAPF to detect if node ends in the desired destination
@@ -246,7 +258,10 @@
 
 protected:
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 
@@ -256,12 +271,16 @@
 	inline void PfFollowNode(Node& old_node)
 	{
 		TrackFollower F(Yapf().GetVehicle());
-		if (F.Follow(old_node.m_segment_last_tile, old_node.m_segment_last_td))
+		if (F.Follow(old_node.m_segment_last_tile, old_node.m_segment_last_td)) {
 			Yapf().AddMultipleNodes(&old_node, F);
+		}
 	}
 
 	/// return debug report character to identify the transportation type
-	FORCEINLINE char TransportTypeChar() const {return 'r';}
+	FORCEINLINE char TransportTypeChar() const
+	{
+		return 'r';
+	}
 
 	static Trackdir stChooseRoadTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir)
 	{
@@ -433,14 +452,17 @@
 	PfnDistanceToTile pfnDistanceToTile = &CYapfRoad2::stDistanceToTile; // default: ExitDir, allow 90-deg
 
 	// check if non-default YAPF type should be used
-	if (_settings_game.pf.yapf.disable_node_optimization)
+	if (_settings_game.pf.yapf.disable_node_optimization) {
 		pfnDistanceToTile = &CYapfRoad1::stDistanceToTile; // Trackdir, allow 90-deg
+	}
 
 	// measure distance in YAPF units
 	uint dist = pfnDistanceToTile(v, tile);
 	// convert distance to tiles
-	if (dist != UINT_MAX)
+	if (dist != UINT_MAX) {
 		dist = (dist + YAPF_TILE_LENGTH - 1) / YAPF_TILE_LENGTH;
+	}
+
 	return dist;
 }
 
@@ -448,8 +470,9 @@
 {
 	TileIndex tile = v->tile;
 	Trackdir trackdir = GetVehicleTrackdir(v);
-	if ((TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)) & TrackdirToTrackdirBits(trackdir)) == 0)
+	if ((TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)) & TrackdirToTrackdirBits(trackdir)) == 0) {
 		return NULL;
+	}
 
 	// handle the case when our vehicle is already in the depot tile
 	if (IsRoadDepotTile(tile)) {
@@ -462,8 +485,9 @@
 	PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
 
 	// check if non-default YAPF type should be used
-	if (_settings_game.pf.yapf.disable_node_optimization)
+	if (_settings_game.pf.yapf.disable_node_optimization) {
 		pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
+	}
 
 	Depot *ret = pfnFindNearestDepot(v, tile, trackdir);
 	return ret;
--- a/src/yapf/yapf_ship.cpp
+++ b/src/yapf/yapf_ship.cpp
@@ -18,7 +18,10 @@
 
 protected:
 	/// to access inherited path finder
-	FORCEINLINE Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	FORCEINLINE Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/** Called by YAPF to move from the given node to the next tile. For each
@@ -27,12 +30,16 @@
 	inline void PfFollowNode(Node& old_node)
 	{
 		TrackFollower F(Yapf().GetVehicle());
-		if (F.Follow(old_node.m_key.m_tile, old_node.m_key.m_td))
+		if (F.Follow(old_node.m_key.m_tile, old_node.m_key.m_td)) {
 			Yapf().AddMultipleNodes(&old_node, F);
+		}
 	}
 
 	/// return debug report character to identify the transportation type
-	FORCEINLINE char TransportTypeChar() const {return 'w';}
+	FORCEINLINE char TransportTypeChar() const
+	{
+		return 'w';
+	}
 
 	static Trackdir ChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
 	{
@@ -94,7 +101,10 @@
 
 protected:
 	/// to access inherited path finder
-	Tpf& Yapf() {return *static_cast<Tpf*>(this);}
+	Tpf& Yapf()
+	{
+		return *static_cast<Tpf*>(this);
+	}
 
 public:
 	/** Called by YAPF to calculate the cost from the origin to the given node.
@@ -168,7 +178,7 @@
 }
 
 /** performance measurement helper */
-void * NpfBeginInterval()
+void *NpfBeginInterval()
 {
 	CPerformanceTimer& perf = *new CPerformanceTimer;
 	perf.Start();