changeset 8800 | c30102fee110 |
parent 8795 | 33530273bd31 |
child 8836 | f6f1ea3d7e93 |
8799:6d3a845d5793 | 8800:c30102fee110 |
---|---|
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; |