From 9869611ad8ce7d563ec1b8f42feaab5de9ae3421 Mon Sep 17 00:00:00 2001 From: J0anJosep Date: Wed, 10 May 2023 22:02:27 +0200 Subject: [PATCH] Change: Ships enter depots when they are in the middle of the two depot tiles (not in the center of a tile). # Conflicts: # src/ship_cmd.cpp --- src/ship_cmd.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index cc0e94a5e3..cd7ff42ad9 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -773,13 +773,6 @@ static void ShipController(Ship *v) UpdateVehicleTimetable(v, true); v->IncrementRealOrderIndex(); v->current_order.MakeDummy(); - } else if (v->current_order.IsType(OT_GOTO_DEPOT) && - v->dest_tile == gp.new_tile) { - /* Depot orders really need to reach the tile */ - if ((gp.x & 0xF) == 8 && (gp.y & 0xF) == 8) { - VehicleEnterDepot(v); - return; - } } else if (v->current_order.IsType(OT_GOTO_STATION) && IsDockingTile(gp.new_tile)) { /* Process station in the orderlist. */ Station *st = Station::Get(v->current_order.GetDestination()); @@ -800,6 +793,16 @@ static void ShipController(Ship *v) /* New tile */ if (!IsValidTile(gp.new_tile)) return ReverseShip(v); + if (v->current_order.IsType(OT_GOTO_DEPOT) && + IsShipDepotTile(gp.new_tile) && + GetOtherShipDepotTile(gp.new_tile) == gp.old_tile && + v->current_order.GetDestination() == GetDepotIndex(gp.new_tile)) { + HandleShipEnterDepot(v); + v->UpdatePosition(); + v->UpdateViewport(true, true); + return; + } + const DiagDirection diagdir = DiagdirBetweenTiles(gp.old_tile, gp.new_tile); assert(diagdir != INVALID_DIAGDIR); const TrackBits tracks = GetAvailShipTracks(gp.new_tile, diagdir);