diff options
author | PeterN <peter@fuzzle.org> | 2018-06-14 09:25:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-14 09:25:39 +0100 |
commit | c2a77280842b5d752ef6c744adab20d9d1b67857 (patch) | |
tree | 1598d70926196cdaf99b64396a8624c1774411dc /src/ship_cmd.cpp | |
parent | 7ae1e3e1e2a23b5cbd09bc88f9abd7ccdde23201 (diff) | |
download | openttd-c2a77280842b5d752ef6c744adab20d9d1b67857.tar.xz |
Fix: Prevent ships moving into docks after finishing (un)loading. (#6791)
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 967cd4e1d..0bdcf7041 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -537,6 +537,10 @@ static void ShipController(Ship *v) if (v->current_order.IsType(OT_LEAVESTATION)) { v->current_order.Free(); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); + /* Test if continuing forward would lead to a dead-end, moving into the dock. */ + DiagDirection exitdir = VehicleExitDir(v->direction, v->state); + TileIndex tile = TileAddByDiagDir(v->tile, exitdir); + if (TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0, exitdir)) == TRACK_BIT_NONE) goto reverse_direction; } else if (v->dest_tile != 0) { /* We have a target, let's see if we reached it... */ if (v->current_order.IsType(OT_GOTO_WAYPOINT) && |