src/ship_cmd.cpp
changeset 8732 b18f578f7c16
parent 8726 5ae45b46506b
child 8750 fdd6054e7bae
equal deleted inserted replaced
8731:a2cab8a23491 8732:b18f578f7c16
   119 	TileIndex tile2 = v->tile;
   119 	TileIndex tile2 = v->tile;
   120 
   120 
   121 	if (_patches.new_pathfinding_all) {
   121 	if (_patches.new_pathfinding_all) {
   122 		NPFFoundTargetData ftd;
   122 		NPFFoundTargetData ftd;
   123 		Trackdir trackdir = GetVehicleTrackdir(v);
   123 		Trackdir trackdir = GetVehicleTrackdir(v);
   124 		ftd = NPFRouteToDepotTrialError(v->tile, trackdir, TRANSPORT_WATER, 0, v->owner, INVALID_RAILTYPE);
   124 		ftd = NPFRouteToDepotTrialError(v->tile, trackdir, TRANSPORT_WATER, 0, v->owner, INVALID_RAILTYPES);
   125 		if (ftd.best_bird_dist == 0) {
   125 		if (ftd.best_bird_dist == 0) {
   126 			best_depot = GetDepotByTile(ftd.node.tile); /* Found target */
   126 			best_depot = GetDepotByTile(ftd.node.tile); /* Found target */
   127 		} else {
   127 		} else {
   128 			best_depot = NULL; /* Did not find target */
   128 			best_depot = NULL; /* Did not find target */
   129 		}
   129 		}
   506 
   506 
   507 	*track = best_track;
   507 	*track = best_track;
   508 	return best_bird_dist;
   508 	return best_bird_dist;
   509 }
   509 }
   510 
   510 
   511 static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, NPFFindStationOrTileData* target, TransportType type, Owner owner, RailTypeMask railtypes)
   511 static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, NPFFindStationOrTileData* target, TransportType type, Owner owner, RailTypes railtypes)
   512 {
   512 {
   513 
   513 
   514 	void* perf = NpfBeginInterval();
   514 	void* perf = NpfBeginInterval();
   515 	NPFFoundTargetData ret = NPFRouteToStationOrTile(tile, trackdir, target, type, 0, owner, railtypes);
   515 	NPFFoundTargetData ret = NPFRouteToStationOrTile(tile, trackdir, target, type, 0, owner, railtypes);
   516 	int t = NpfEndInterval(perf);
   516 	int t = NpfEndInterval(perf);
   535 		Trackdir trackdir = GetVehicleTrackdir(v);
   535 		Trackdir trackdir = GetVehicleTrackdir(v);
   536 		assert(trackdir != INVALID_TRACKDIR); // Check that we are not in a depot
   536 		assert(trackdir != INVALID_TRACKDIR); // Check that we are not in a depot
   537 
   537 
   538 		NPFFillWithOrderData(&fstd, v);
   538 		NPFFillWithOrderData(&fstd, v);
   539 
   539 
   540 		ftd = PerfNPFRouteToStationOrTile(src_tile, trackdir, &fstd, TRANSPORT_WATER, v->owner, INVALID_RAILTYPE);
   540 		ftd = PerfNPFRouteToStationOrTile(src_tile, trackdir, &fstd, TRANSPORT_WATER, v->owner, INVALID_RAILTYPES);
   541 
   541 
   542 		if (ftd.best_trackdir != 0xff) {
   542 		if (ftd.best_trackdir != 0xff) {
   543 			/* If ftd.best_bird_dist is 0, we found our target and ftd.best_trackdir contains
   543 			/* If ftd.best_bird_dist is 0, we found our target and ftd.best_trackdir contains
   544 			the direction we need to take to get there, if ftd.best_bird_dist is not 0,
   544 			the direction we need to take to get there, if ftd.best_bird_dist is not 0,
   545 			we did not find our target, but ftd.best_trackdir contains the direction leading
   545 			we did not find our target, but ftd.best_trackdir contains the direction leading