Loading

Revision differences

Old revision #pl9ow49laNew revision #pu2pzubvn
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@@ -335,19 +335,18 @@
6   6   
7     TrackBits north_tracks = DiagdirReachesTracks(north_dir) & GetTileShipTrackStatus(north_neighbour);  7     TrackBits north_tracks = DiagdirReachesTracks(north_dir) & GetTileShipTrackStatus(north_neighbour);  
8     TrackBits south_tracks = DiagdirReachesTracks(south_dir) & GetTileShipTrackStatus(south_neighbour);  8     TrackBits south_tracks = DiagdirReachesTracks(south_dir) & GetTileShipTrackStatus(south_neighbour);  
  9-    if (north_tracks && south_tracks) {  
  10-        /* Ask pathfinder for best direction */  
  11-        bool reverse = false;  
  12-        bool path_found;  
  13-        switch (_settings_game.pf.pathfinder_for_ships) {  
  14-            case VPF_OPF: reverse = OPFShipChooseTrack(v, north_neighbour, north_dir, north_tracks, path_found) == INVALID_TRACK; break; // OPF always allows reversing  
  15-            case VPF_NPF: reverse = NPFShipCheckReverse(v); break;  
  16-            case VPF_YAPF: reverse = YapfShipCheckReverse(v); break;  
  17-            default: NOT_REACHED();  
  18-        }  
  19-        if (reverse) north_tracks = TRACK_BIT_NONE;  
9+  20+  
  21+    /* Ask pathfinder for best direction */  
10+    bool reverse = false;  22+    bool reverse = false;  
11+  23+    bool path_found;
12     if (north_tracks && south_tracks) {  24+    switch (_settings_game.pf.pathfinder_for_ships) {
13         /* Ask pathfinder for best direction */  25+        case VPF_OPF: reverse = OPFShipChooseTrack(v, north_neighbour, north_dir, north_tracks, path_found) == INVALID_TRACK; break; // OPF always allows reversing
14-        bool reverse = false;  26+        case VPF_NPF: reverse = NPFShipCheckReverse(v); break;
15         bool path_found;  27+        case VPF_YAPF: reverse = YapfShipCheckReverse(v); break;
16         switch (_settings_game.pf.pathfinder_for_ships) {  28+        default: NOT_REACHED();
17             case VPF_OPF: reverse = OPFShipChooseTrack(v, north_neighbour, north_dir, north_tracks, path_found) == INVALID_TRACK; break; // OPF always allows reversing  29     }
18@@ -356,7 +358,11 @@  30-
   31+    if (reverse) north_tracks = TRACK_BIT_NONE;
   32+   
   33     if (north_tracks) {
   34         /* Leave towards north */
   35         v->direction = DiagDirToDir(north_dir);
   36@@ -356,7 +355,11 @@
19         v->direction = DiagDirToDir(south_dir);  37         v->direction = DiagDirToDir(south_dir);  
20     } else {  38     } else {  
21         /* Both ways blocked */  39         /* Both ways blocked */