14 | const Track main_track_mask = TrackBitsToTrack(TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)));
| | |
---|
15 | const Track oppo_track_mask = TrackToOppositeTrack(main_track_mask);
| | |
---|
16 | const Trackdir main_trackdir = TrackToTrackdir(main_track_mask);
| | |
---|
17 | const Trackdir oppo_trackdir = TrackToTrackdir(oppo_track_mask);
| | |
---|
18 | const DiagDirection main_dir_1 = TrackdirToExitdir(main_trackdir);
| | |
---|
19 | const DiagDirection main_dir_2 = TrackdirToExitdir(ReverseTrackdir(main_trackdir));
| | |
---|
20 | const DiagDirection oppo_dir_1 = TrackdirToExitdir(oppo_trackdir);
| | |
---|
21 | const DiagDirection oppo_dir_2 = TrackdirToExitdir(ReverseTrackdir(oppo_trackdir));
| | |
---|
22 |
| | |
---|
23 | TrackBits main_trackbits_mask_1 = DiagdirReachesTracks(main_dir_1);
| | |
---|
24 | TrackBits main_trackbits_mask_2 = DiagdirReachesTracks(main_dir_2);
| | |
---|
25 | TrackBits oppo_trackbits_mask_1 = DiagdirReachesTracks(oppo_dir_1);
| | |
---|
26 | TrackBits oppo_trackbits_mask_2 = DiagdirReachesTracks(oppo_dir_2);
| | |
---|
27 |
| | |
---|
28 | if (_settings_game.pf.forbid_90_deg) {
| | |
---|
29 | main_trackbits_mask_1 &= ~TrackCrossesTracks(main_track_mask);
| | |
---|
30 | main_trackbits_mask_2 &= ~TrackCrossesTracks(main_track_mask);
| | |
---|
31 | oppo_trackbits_mask_1 &= ~TrackCrossesTracks(oppo_track_mask);
| | |
---|
32 | oppo_trackbits_mask_2 &= ~TrackCrossesTracks(oppo_track_mask);
| | |
---|
33 | }
| | |
---|
34 |
| | |
---|
35 | Corner corner = GetHighestSlopeCorner(slope);
| 15 | Corner corner = GetHighestSlopeCorner(slope);
|
---|
36 | static const Direction corner_to_direction[] = { DIR_W, DIR_S, DIR_E, DIR_N };
| 16 | static const Direction corner_to_direction[] = { DIR_W, DIR_S, DIR_E, DIR_N };
|
---|
37 | TileIndex opposite_tile = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir(corner_to_direction[OppositeCorner(corner)]));
| 17 | TileIndex opposite_tile = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir(corner_to_direction[OppositeCorner(corner)]));
|
---|
38 |
| 18 |
|
---|
39 | if (IsValidTile(opposite_tile)) {
| 19 | if (IsValidTile(opposite_tile)) {
|
---|
40 | TileIndex tile_1 = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDiagDir(main_dir_1));
| 26 | TileIndex tile_1 = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDiagDir(main_dir_1));
|
---|
41 | TileIndex tile_2 = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDiagDir(main_dir_2));
| 27 | TileIndex tile_2 = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDiagDir(main_dir_2));
|
---|
42 |
| 28 |
|
---|
43 | TrackBits track_1 = TrackStatusToTrackBits(GetTileTrackStatus(tile_1, TRANSPORT_WATER, 0));
| 29 | TrackBits track_1 = TrackStatusToTrackBits(GetTileTrackStatus(tile_1, TRANSPORT_WATER, 0));
|
---|
44 | TrackBits track_2 = TrackStatusToTrackBits(GetTileTrackStatus(tile_2, TRANSPORT_WATER, 0));
| 30 | TrackBits track_2 = TrackStatusToTrackBits(GetTileTrackStatus(tile_2, TRANSPORT_WATER, 0));
|
---|
45 |
| 31 |
|
---|
50 |
| 37 |
|
---|
51 | /* Is there a connection between tile_1 and tile_2 via tile? */
| 38 | /* Is there a connection between tile_1 and tile_2 via tile? */
|
---|
52 | if (main_track_1 && main_track_2) {
| 39 | if (main_track_1 && main_track_2) {
|
---|
53 | TrackBits oppo_trackbits = TrackStatusToTrackBits(GetTileTrackStatus(opposite_tile, TRANSPORT_WATER, 0));
| 40 | TrackBits oppo_trackbits = TrackStatusToTrackBits(GetTileTrackStatus(opposite_tile, TRANSPORT_WATER, 0));
|
---|