Index: src/pathfinder/opf/opf_ship.cpp
===================================================================
--- src/pathfinder/opf/opf_ship.cpp (revision 27846)
+++ src/pathfinder/opf/opf_ship.cpp (working copy)
@@ -20,7 +20,7 @@
struct RememberData {
uint16 cur_length;
byte depth;
- Track last_choosen_track;
+ Trackdir last_choosen_trackdir;
};
struct TrackPathFinder {
@@ -89,15 +89,16 @@
RememberData rd = tpf->rd;
/* Change direction 4 times only */
- if (!only_one_track && track != tpf->rd.last_choosen_track) {
+ Trackdir trackdir = TrackEnterdirToTrackdir(track, direction);
+ if (!only_one_track && trackdir != tpf->rd.last_choosen_trackdir) {
if (++tpf->rd.depth > 4) {
tpf->rd = rd;
return;
}
- tpf->rd.last_choosen_track = track;
+ tpf->rd.last_choosen_trackdir = trackdir;
}
- tpf->the_dir = TrackEnterdirToTrackdir(track, direction);
+ tpf->the_dir = trackdir;
if (!ShipTrackFollower(tile, tpf, tpf->rd.cur_length)) {
TPFModeShip(tpf, tile, TrackdirToExitdir(tpf->the_dir));
@@ -114,7 +115,7 @@
/* initialize path finder variables */
tpf->rd.cur_length = 0;
tpf->rd.depth = 0;
- tpf->rd.last_choosen_track = INVALID_TRACK;
+ tpf->rd.last_choosen_trackdir = INVALID_TRACKDIR;
ShipTrackFollower(tile, tpf, 0);
TPFModeShip(tpf, tile, direction);