Changeset - r11916:e3a8d08bf479
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-05-16 20:10:58
rubidium@openttd.org
(svn r16323) -Fix [FS#2900]: desyncs due to the fact that depot searching with a maximum search depth simply does not work with YAPF's caches.
2 files changed with 14 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/yapf/yapf_costrail.hpp
Show inline comments
 
@@ -54,6 +54,10 @@ protected:
 
	};
 

	
 
protected:
 
	/**
 
	 * @note maximum cost doesn't work with caching enabled
 
	 * @todo fix maximum cost failing with caching (e.g. FS#2900)
 
	 */
 
	int           m_max_cost;
 
	CBlobT<int>   m_sig_look_ahead_costs;
 
	bool          m_disable_cache;
src/yapf/yapf_rail.cpp
Show inline comments
 
@@ -213,6 +213,16 @@ public:
 
	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)
 
	{
 
		Tpf pf1;
 
		/*
 
		 * With caching enabled it simply cannot get a reliable result when you
 
		 * have limited the distance a train may travel. This means that the
 
		 * cached result does not match uncached result in all cases and that
 
		 * causes desyncs. So disable caching when finding for a depot that is
 
		 * nearby. This only happens with automatic servicing of vehicles,
 
		 * so it will only impact performance when you do not manually set
 
		 * depot orders and you do not disable automatic servicing.
 
		 */
 
		if (max_distance != 0) pf1.DisableCache(true);
 
		bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_distance, reverse_penalty, depot_tile, reversed);
 

	
 
#if DEBUG_YAPF_CACHE
0 comments (0 inline, 0 general)