Loading

Paste #pu2pzubvn

  1. Index: src/ship_cmd.cpp
  2. ===================================================================
  3. --- src/ship_cmd.cpp    (revision 27221)
  4. +++ src/ship_cmd.cpp    (working copy)
  5. @@ -335,19 +335,18 @@
  6.  
  7.     TrackBits north_tracks = DiagdirReachesTracks(north_dir) & GetTileShipTrackStatus(north_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;
  20. +
  21. +   /* Ask pathfinder for best direction */
  22. +   bool reverse = false;
  23. +   bool path_found;
  24. +   switch (_settings_game.pf.pathfinder_for_ships) {
  25. +       case VPF_OPF: reverse = OPFShipChooseTrack(v, north_neighbour, north_dir, north_tracks, path_found) == INVALID_TRACK; break; // OPF always allows reversing
  26. +       case VPF_NPF: reverse = NPFShipCheckReverse(v); break;
  27. +       case VPF_YAPF: reverse = YapfShipCheckReverse(v); break;
  28. +       default: NOT_REACHED();
  29.     }
  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 @@
  37.         v->direction = DiagDirToDir(south_dir);
  38.     } else {
  39.         /* Both ways blocked */
  40. -       return false;
  41. +       if (reverse) {
  42. +           v->direction = DiagDirToDir(south_dir);
  43. +       } else {
  44. +           v->direction = DiagDirToDir(north_dir);
  45. +       }
  46.     }
  47.  
  48.     v->state = AxisToTrackBits(axis);

Version history

Revision # Author Created at
pl9ow49la Anonymous 09 Apr 2015, 01:23:31 UTC Diff

Comments