src/ai/default/default.cpp
changeset 10236 50afe9dd466e
parent 10225 eb61dd8101c1
equal deleted inserted replaced
10235:531716190738 10236:50afe9dd466e
  2156 	arf.final_tile = _companies_ai[c->index].cur_tile_b;
  2156 	arf.final_tile = _companies_ai[c->index].cur_tile_b;
  2157 	arf.final_dir = _companies_ai[c->index].cur_dir_b;
  2157 	arf.final_dir = _companies_ai[c->index].cur_dir_b;
  2158 	arf.depth = 0;
  2158 	arf.depth = 0;
  2159 	arf.recursive_mode = 0;
  2159 	arf.recursive_mode = 0;
  2160 	arf.best_ptr = NULL;
  2160 	arf.best_ptr = NULL;
  2161 	arf.cur_best_dist = (uint)-1;
  2161 	arf.cur_best_dist = UINT_MAX;
  2162 	arf.cur_best_depth = 0xff;
  2162 	arf.cur_best_depth = 0xff;
  2163 	arf.best_dist = (uint)-1;
  2163 	arf.best_dist = UINT_MAX;
  2164 	arf.best_depth = 0xff;
  2164 	arf.best_depth = 0xff;
  2165 	arf.cur_best_tile = 0;
  2165 	arf.cur_best_tile = 0;
  2166 	arf.best_tile = 0;
  2166 	arf.best_tile = 0;
  2167 	AiBuildRailRecursive(&arf, _companies_ai[c->index].cur_tile_a, _companies_ai[c->index].cur_dir_a);
  2167 	AiBuildRailRecursive(&arf, _companies_ai[c->index].cur_tile_a, _companies_ai[c->index].cur_dir_a);
  2168 
  2168 
  2853 			arf->best_tile = 0;
  2853 			arf->best_tile = 0;
  2854 			better = true;
  2854 			better = true;
  2855 		}
  2855 		}
  2856 	}
  2856 	}
  2857 	arf->recursive_mode = 0;
  2857 	arf->recursive_mode = 0;
  2858 	arf->cur_best_dist = (uint)-1;
  2858 	arf->cur_best_dist = UINT_MAX;
  2859 	arf->cur_best_depth = 0xff;
  2859 	arf->cur_best_depth = 0xff;
  2860 
  2860 
  2861 	return better;
  2861 	return better;
  2862 }
  2862 }
  2863 
  2863 
  2890 
  2890 
  2891 	if (IsRoadStopTile(tile) || IsRoadDepotTile(tile)) return false;
  2891 	if (IsRoadStopTile(tile) || IsRoadDepotTile(tile)) return false;
  2892 	TrackdirBits bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & DiagdirReachesTrackdirs(dir);
  2892 	TrackdirBits bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & DiagdirReachesTrackdirs(dir);
  2893 	if (bits == TRACKDIR_BIT_NONE) return false;
  2893 	if (bits == TRACKDIR_BIT_NONE) return false;
  2894 
  2894 
  2895 	are.best_dist = (uint)-1;
  2895 	are.best_dist = UINT_MAX;
  2896 
  2896 
  2897 	while (bits != TRACKDIR_BIT_NONE) {
  2897 	while (bits != TRACKDIR_BIT_NONE) {
  2898 		Trackdir trackdir = RemoveFirstTrackdir(&bits);
  2898 		Trackdir trackdir = RemoveFirstTrackdir(&bits);
  2899 		FollowTrack(tile, PATHFIND_FLAGS_DISABLE_TILE_HASH, TRANSPORT_ROAD, ROADTYPES_ROAD, TrackdirToExitdir(trackdir), (TPFEnumProc*)AiEnumFollowRoad, NULL, &are);
  2899 		FollowTrack(tile, PATHFIND_FLAGS_DISABLE_TILE_HASH, TRANSPORT_ROAD, ROADTYPES_ROAD, TrackdirToExitdir(trackdir), (TPFEnumProc*)AiEnumFollowRoad, NULL, &are);
  2900 	}
  2900 	}
  3056 	arf.final_tile = _companies_ai[c->index].cur_tile_b;
  3056 	arf.final_tile = _companies_ai[c->index].cur_tile_b;
  3057 	arf.final_dir = _companies_ai[c->index].cur_dir_b;
  3057 	arf.final_dir = _companies_ai[c->index].cur_dir_b;
  3058 	arf.depth = 0;
  3058 	arf.depth = 0;
  3059 	arf.recursive_mode = 0;
  3059 	arf.recursive_mode = 0;
  3060 	arf.best_ptr = NULL;
  3060 	arf.best_ptr = NULL;
  3061 	arf.cur_best_dist = (uint)-1;
  3061 	arf.cur_best_dist = UINT_MAX;
  3062 	arf.cur_best_depth = 0xff;
  3062 	arf.cur_best_depth = 0xff;
  3063 	arf.best_dist = (uint)-1;
  3063 	arf.best_dist = UINT_MAX;
  3064 	arf.best_depth =  0xff;
  3064 	arf.best_depth =  0xff;
  3065 	arf.cur_best_tile = 0;
  3065 	arf.cur_best_tile = 0;
  3066 	arf.best_tile = 0;
  3066 	arf.best_tile = 0;
  3067 	AiBuildRoadRecursive(&arf, _companies_ai[c->index].cur_tile_a, _companies_ai[c->index].cur_dir_a);
  3067 	AiBuildRoadRecursive(&arf, _companies_ai[c->index].cur_tile_a, _companies_ai[c->index].cur_dir_a);
  3068 
  3068