Old revision #pl9ow49la | New revision #pt1vlref5 | ||
---|---|---|---|
2 | =================================================================== | 2 | =================================================================== |
3 | --- src/ship_cmd.cpp (revision 27221) | 3 | --- src/ship_cmd.cpp (revision 27221) |
4 | +++ src/ship_cmd.cpp (working copy) | 4 | +++ src/ship_cmd.cpp (working copy) |
5 | @@ -335,9 +335,11 @@ | 5 | @@ -356,7 +356,19 @@ |
6 | |||
7 | TrackBits north_tracks = DiagdirReachesTracks(north_dir) & GetTileShipTrackStatus(north_neighbour); | ||
8 | TrackBits south_tracks = DiagdirReachesTracks(south_dir) & GetTileShipTrackStatus(south_neighbour); | ||
9 | + | ||
10 | + bool reverse = false; | ||
11 | + | ||
12 | if (north_tracks && south_tracks) { | ||
13 | /* Ask pathfinder for best direction */ | ||
14 | - bool reverse = false; | ||
15 | bool path_found; | ||
16 | switch (_settings_game.pf.pathfinder_for_ships) { | ||
17 | case VPF_OPF: reverse = OPFShipChooseTrack(v, north_neighbour, north_dir, north_tracks, path_found) == INVALID_TRACK; break; // OPF always allows reversing | ||
18 | @@ -356,7 +358,11 @@ | ||
19 | v->direction = DiagDirToDir(south_dir); | 6 | v->direction = DiagDirToDir(south_dir); |
20 | } else { | 7 | } else { |
21 | /* Both ways blocked */ | 8 | /* Both ways blocked */ |
22 | - return false; | 9 | - return false; |
10 | + /* Ask pathfinder for best direction */ | ||
11 | + bool reverse = false; | ||
12 | + switch (_settings_game.pf.pathfinder_for_ships) { | ||
13 | + case VPF_OPF: break; // Just go north, because OPF gives assertion if it's asked to give a direction. | ||
14 | + case VPF_NPF: reverse = NPFShipCheckReverse(v); break; // Ugly behaviour. It better reverse mid-water than head to the worng direction. | ||
15 | + case VPF_YAPF: reverse = YapfShipCheckReverse(v); break; // Best looking behaviour. | ||
16 | + default: NOT_REACHED(); | ||
17 | + } | ||
23 | + if (reverse) { | 18 | + if (reverse) { |
24 | + v->direction = DiagDirToDir(south_dir); | 19 | + v->direction = DiagDirToDir(south_dir); |
25 | + } else { | 20 | + } else { |