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: break; // Just go north, because OPF gives assertion if it's asked to give a direction.
+ case VPF_NPF: reverse = NPFShipCheckReverse(v); break; // Ugly behaviour. It better reverse mid-water than head to the worng direction.
+ case VPF_YAPF: reverse = YapfShipCheckReverse(v); break; // Best looking behaviour.
+ default: NOT_REACHED();
+ }
+ if (reverse) {
+ v->direction = DiagDirToDir(south_dir);
+ } else {
+ v->direction = DiagDirToDir(north_dir);
+ }
}
v->state = AxisToTrackBits(axis);