src/yapf/yapf_rail.cpp
changeset 10703 2c998f3776d1
parent 10429 1b99254f9607
child 10775 7061477bfbcf
equal deleted inserted replaced
10702:d36547edcb86 10703:2c998f3776d1
   252 	// default is YAPF type 2
   252 	// default is YAPF type 2
   253 	typedef Trackdir (*PfnChooseRailTrack)(Vehicle*, TileIndex, DiagDirection, TrackBits, bool*);
   253 	typedef Trackdir (*PfnChooseRailTrack)(Vehicle*, TileIndex, DiagDirection, TrackBits, bool*);
   254 	PfnChooseRailTrack pfnChooseRailTrack = &CYapfRail1::stChooseRailTrack;
   254 	PfnChooseRailTrack pfnChooseRailTrack = &CYapfRail1::stChooseRailTrack;
   255 
   255 
   256 	// check if non-default YAPF type needed
   256 	// check if non-default YAPF type needed
   257 	if (_patches.forbid_90_deg) {
   257 	if (_settings.pf.forbid_90_deg) {
   258 		pfnChooseRailTrack = &CYapfRail2::stChooseRailTrack; // Trackdir, forbid 90-deg
   258 		pfnChooseRailTrack = &CYapfRail2::stChooseRailTrack; // Trackdir, forbid 90-deg
   259 	}
   259 	}
   260 
   260 
   261 	Trackdir td_ret = pfnChooseRailTrack(v, tile, enterdir, tracks, path_not_found);
   261 	Trackdir td_ret = pfnChooseRailTrack(v, tile, enterdir, tracks, path_not_found);
   262 
   262 
   309 
   309 
   310 	typedef bool (*PfnCheckReverseTrain)(Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int);
   310 	typedef bool (*PfnCheckReverseTrain)(Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int);
   311 	PfnCheckReverseTrain pfnCheckReverseTrain = CYapfRail1::stCheckReverseTrain;
   311 	PfnCheckReverseTrain pfnCheckReverseTrain = CYapfRail1::stCheckReverseTrain;
   312 
   312 
   313 	// check if non-default YAPF type needed
   313 	// check if non-default YAPF type needed
   314 	if (_patches.forbid_90_deg) {
   314 	if (_settings.pf.forbid_90_deg) {
   315 		pfnCheckReverseTrain = &CYapfRail2::stCheckReverseTrain; // Trackdir, forbid 90-deg
   315 		pfnCheckReverseTrain = &CYapfRail2::stCheckReverseTrain; // Trackdir, forbid 90-deg
   316 	}
   316 	}
   317 
   317 
   318 	/* slightly hackish: If the pathfinders finds a path, the cost of the first node is tested to distinguish between forward- and reverse-path. */
   318 	/* slightly hackish: If the pathfinders finds a path, the cost of the first node is tested to distinguish between forward- and reverse-path. */
   319 	if (reverse_penalty == 0) reverse_penalty = 1;
   319 	if (reverse_penalty == 0) reverse_penalty = 1;
   339 
   339 
   340 	typedef bool (*PfnFindNearestDepotTwoWay)(Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int, int, TileIndex*, bool*);
   340 	typedef bool (*PfnFindNearestDepotTwoWay)(Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int, int, TileIndex*, bool*);
   341 	PfnFindNearestDepotTwoWay pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail1::stFindNearestDepotTwoWay;
   341 	PfnFindNearestDepotTwoWay pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail1::stFindNearestDepotTwoWay;
   342 
   342 
   343 	// check if non-default YAPF type needed
   343 	// check if non-default YAPF type needed
   344 	if (_patches.forbid_90_deg) {
   344 	if (_settings.pf.forbid_90_deg) {
   345 		pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail2::stFindNearestDepotTwoWay; // Trackdir, forbid 90-deg
   345 		pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail2::stFindNearestDepotTwoWay; // Trackdir, forbid 90-deg
   346 	}
   346 	}
   347 
   347 
   348 	bool ret = pfnFindNearestDepotTwoWay(v, tile, td, last_tile, td_rev, max_distance, reverse_penalty, depot_tile, reversed);
   348 	bool ret = pfnFindNearestDepotTwoWay(v, tile, td, last_tile, td_rev, max_distance, reverse_penalty, depot_tile, reversed);
   349 	return ret;
   349 	return ret;