changeset 9296 | 5878a50c67b2 |
parent 9291 | 1fb2b3c2099f |
child 9332 | 2e120d0bd632 |
9295:50de67372594 | 9296:5878a50c67b2 |
---|---|
1920 |
1920 |
1921 arpfd.tile = _players_ai[p->index].start_tile_a; |
1921 arpfd.tile = _players_ai[p->index].start_tile_a; |
1922 arpfd.tile2 = _players_ai[p->index].cur_tile_a; |
1922 arpfd.tile2 = _players_ai[p->index].cur_tile_a; |
1923 arpfd.flag = false; |
1923 arpfd.flag = false; |
1924 arpfd.count = 0; |
1924 arpfd.count = 0; |
1925 FollowTrack(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(_players_ai[p->index].cur_dir_a), TRANSPORT_RAIL, 0, ReverseDiagDir(_players_ai[p->index].cur_dir_a), |
1925 FollowTrack(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(_players_ai[p->index].cur_dir_a), PATHFIND_FLAGS_NONE, TRANSPORT_RAIL, 0, ReverseDiagDir(_players_ai[p->index].cur_dir_a), |
1926 (TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd); |
1926 (TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd); |
1927 return arpfd.count > 8; |
1927 return arpfd.count > 8; |
1928 } |
1928 } |
1929 |
1929 |
1930 struct AiRailFinder { |
1930 struct AiRailFinder { |
2895 |
2895 |
2896 are.best_dist = (uint)-1; |
2896 are.best_dist = (uint)-1; |
2897 |
2897 |
2898 while (bits != TRACKDIR_BIT_NONE) { |
2898 while (bits != TRACKDIR_BIT_NONE) { |
2899 Trackdir trackdir = RemoveFirstTrackdir(&bits); |
2899 Trackdir trackdir = RemoveFirstTrackdir(&bits); |
2900 FollowTrack(tile, 0x1000 | TRANSPORT_ROAD, ROADTYPES_ROAD, TrackdirToExitdir(trackdir), (TPFEnumProc*)AiEnumFollowRoad, NULL, &are); |
2900 FollowTrack(tile, PATHFIND_FLAGS_DISABLE_TILE_HASH, TRANSPORT_ROAD, ROADTYPES_ROAD, TrackdirToExitdir(trackdir), (TPFEnumProc*)AiEnumFollowRoad, NULL, &are); |
2901 } |
2901 } |
2902 |
2902 |
2903 if (DistanceManhattan(tile, are.dest) <= are.best_dist) return false; |
2903 if (DistanceManhattan(tile, are.dest) <= are.best_dist) return false; |
2904 |
2904 |
2905 if (are.best_dist == 0) return true; |
2905 if (are.best_dist == 0) return true; |