Loading

Paste #p97vrjhju

  1. Index: src/pathfinder/opf/opf_ship.cpp
  2. ===================================================================
  3. --- src/pathfinder/opf/opf_ship.cpp (revision 27846)
  4. +++ src/pathfinder/opf/opf_ship.cpp (working copy)
  5. @@ -20,7 +20,7 @@
  6.  struct RememberData {
  7.     uint16 cur_length;
  8.     byte depth;
  9. -   Track last_choosen_track;
  10. +   Trackdir last_choosen_trackdir;
  11.  };
  12.  
  13.  struct TrackPathFinder {
  14. @@ -89,15 +89,16 @@
  15.         RememberData rd = tpf->rd;
  16.  
  17.         /* Change direction 4 times only */
  18. -       if (!only_one_track && track != tpf->rd.last_choosen_track) {
  19. +       Trackdir trackdir = TrackEnterdirToTrackdir(track, direction);
  20. +       if (!only_one_track && trackdir != tpf->rd.last_choosen_trackdir) {
  21.             if (++tpf->rd.depth > 4) {
  22.                 tpf->rd = rd;
  23.                 return;
  24.             }
  25. -           tpf->rd.last_choosen_track = track;
  26. +           tpf->rd.last_choosen_trackdir = trackdir;
  27.         }
  28.  
  29. -       tpf->the_dir = TrackEnterdirToTrackdir(track, direction);
  30. +       tpf->the_dir = trackdir;
  31.  
  32.         if (!ShipTrackFollower(tile, tpf, tpf->rd.cur_length)) {
  33.             TPFModeShip(tpf, tile, TrackdirToExitdir(tpf->the_dir));
  34. @@ -114,7 +115,7 @@
  35.     /* initialize path finder variables */
  36.     tpf->rd.cur_length = 0;
  37.     tpf->rd.depth = 0;
  38. -   tpf->rd.last_choosen_track = INVALID_TRACK;
  39. +   tpf->rd.last_choosen_trackdir = INVALID_TRACKDIR;
  40.  
  41.     ShipTrackFollower(tile, tpf, 0);
  42.     TPFModeShip(tpf, tile, direction);

Comments