Changeset - r4989:22561c7756c2
[Not reviewed]
master
0 1 0
tron - 18 years ago 2006-10-28 12:43:15
tron@openttd.org
(svn r6992) Make a const_cast<> obsolete by properly propagating the type
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
yapf/yapf_road.cpp
Show inline comments
 
@@ -345,13 +345,13 @@ public:
 
		return true;
 
	}
 

	
 
	static Depot* stFindNearestDepot(Vehicle* v, TileIndex tile, Trackdir td)
 
	static Depot* stFindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td)
 
	{
 
		Tpf pf;
 
		return pf.FindNearestDepot(v, tile, td);
 
	}
 

	
 
	FORCEINLINE Depot* FindNearestDepot(Vehicle* v, TileIndex tile, Trackdir td)
 
	FORCEINLINE Depot* FindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td)
 
	{
 
		// set origin and destination nodes
 
		Yapf().SetOrigin(tile, TrackdirToTrackdirBits(td));
 
@@ -440,13 +440,13 @@ Depot* YapfFindNearestRoadDepot(const Ve
 
	}
 

	
 
	// default is YAPF type 2
 
	typedef Depot* (*PfnFindNearestDepot)(Vehicle*, TileIndex, Trackdir);
 
	typedef Depot* (*PfnFindNearestDepot)(const Vehicle*, TileIndex, Trackdir);
 
	PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
 

	
 
	// check if non-default YAPF type should be used
 
	if (_patches.yapf.disable_node_optimization)
 
		pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
 

	
 
	Depot* ret = pfnFindNearestDepot(const_cast<Vehicle*>(v), tile, trackdir);
 
	Depot* ret = pfnFindNearestDepot(v, tile, trackdir);
 
	return ret;
 
}
0 comments (0 inline, 0 general)