Index: src/ship_cmd.cpp
===================================================================
--- src/ship_cmd.cpp (revision 27221)
+++ src/ship_cmd.cpp (working copy)
@@ -356,7 +356,19 @@
v->direction = DiagDirToDir(south_dir);
} else {
/* Both ways blocked */
- return false;
+ /* Ask pathfinder for best direction */
+ bool reverse = false;
+ switch (_settings_game.pf.pathfinder_for_ships) {
+ case VPF_OPF: reverse = true; break; // OPF always allows reversing
+ case VPF_NPF: reverse = NPFShipCheckReverse(v); break;
+ case VPF_YAPF: reverse = YapfShipCheckReverse(v); break;
+ default: NOT_REACHED();
+ }
+ if (reverse) {
+ v->direction = DiagDirToDir(south_dir);
+ } else {
+ v->direction = DiagDirToDir(north_dir);
+ }
}
v->state = AxisToTrackBits(axis);