Fix: Prevent ships moving into docks after finishing (un)loading. (#6791)

This commit is contained in:
PeterN
2018-06-14 09:25:39 +01:00
committed by GitHub
parent 7ae1e3e1e2
commit c2a7728084
3 changed files with 31 additions and 27 deletions

View File

@@ -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) &&