Loading

Paste #pl9ow49la

  1. Index: src/ship_cmd.cpp
  2. ===================================================================
  3. --- src/ship_cmd.cpp    (revision 27221)
  4. +++ src/ship_cmd.cpp    (working copy)
  5. @@ -335,9 +335,11 @@
  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);
  20.     } else {
  21.         /* Both ways blocked */
  22. -       return false;
  23. +       if (reverse) {
  24. +           v->direction = DiagDirToDir(south_dir);
  25. +       } else {
  26. +           v->direction = DiagDirToDir(north_dir);
  27. +       }
  28.     }
  29.  
  30.     v->state = AxisToTrackBits(axis);

Comments