1
0
Fork 0

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
pull/8480/head
J0anJosep 2023-05-10 22:02:27 +02:00
parent e91483c588
commit 9869611ad8
1 changed files with 10 additions and 7 deletions

View File

@ -773,13 +773,6 @@ static void ShipController(Ship *v)
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
v->IncrementRealOrderIndex(); v->IncrementRealOrderIndex();
v->current_order.MakeDummy(); 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)) { } else if (v->current_order.IsType(OT_GOTO_STATION) && IsDockingTile(gp.new_tile)) {
/* Process station in the orderlist. */ /* Process station in the orderlist. */
Station *st = Station::Get(v->current_order.GetDestination()); Station *st = Station::Get(v->current_order.GetDestination());
@ -800,6 +793,16 @@ static void ShipController(Ship *v)
/* New tile */ /* New tile */
if (!IsValidTile(gp.new_tile)) return ReverseShip(v); 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); const DiagDirection diagdir = DiagdirBetweenTiles(gp.old_tile, gp.new_tile);
assert(diagdir != INVALID_DIAGDIR); assert(diagdir != INVALID_DIAGDIR);
const TrackBits tracks = GetAvailShipTracks(gp.new_tile, diagdir); const TrackBits tracks = GetAvailShipTracks(gp.new_tile, diagdir);