Mercurial > hg > openttd
changeset 17545:2bdf6a8c6631 draft
(svn r22309) -Fix: Make road vehicles, ships and aircraft skip orders if they are leaving a depot and heading to the same one again; just like trains since r16322.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 10 Apr 2011 10:47:21 +0000 |
parents | 09be4c66385a |
children | e7d0a4f1e433 |
files | src/aircraft_cmd.cpp src/roadveh_cmd.cpp src/ship_cmd.cpp |
diffstat | 3 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1311,6 +1311,12 @@ !v->current_order.IsType(OT_GOTO_DEPOT)) return; + /* We are leaving a hangar, but have to go to the exact same one; re-enter */ + if (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDestination() == v->targetairport) { + VehicleEnterDepot(v); + return; + } + /* if the block of the next position is busy, stay put */ if (AirportHasBlock(v, &apc->layout[v->pos], apc)) return;
--- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -941,6 +941,12 @@ int y = TileY(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].y & 0xF); if (first) { + /* We are leaving a depot, but have to go to the exact same one; re-enter */ + if (v->current_order.IsType(OT_GOTO_DEPOT) && v->tile == v->dest_tile) { + VehicleEnterDepot(v); + return true; + } + if (RoadVehFindCloseTo(v, x, y, v->direction, false) != NULL) return true; VehicleServiceInDepot(v);
--- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -266,9 +266,16 @@ { 0, -1} }; -static void CheckShipLeaveDepot(Ship *v) +static bool CheckShipLeaveDepot(Ship *v) { - if (!v->IsInDepot()) return; + if (!v->IsInDepot()) return false; + + /* We are leaving a depot, but have to go to the exact same one; re-enter */ + if (v->current_order.IsType(OT_GOTO_DEPOT) && + IsShipDepotTile(v->tile) && GetDepotIndex(v->tile) == v->current_order.GetDestination()) { + VehicleEnterDepot(v); + return true; + } TileIndex tile = v->tile; Axis axis = GetShipDepotAxis(tile); @@ -280,7 +287,7 @@ } else if (DiagdirReachesTracks((DiagDirection)(axis + 2)) & GetTileShipTrackStatus(TILE_ADD(tile, -2 * ToTileIndexDiff(_ship_leave_depot_offs[axis])))) { v->direction = AxisToDirection(axis); } else { - return; + return false; } v->state = AxisToTrackBits(axis); @@ -294,6 +301,8 @@ VehicleServiceInDepot(v); InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile); SetWindowClassesDirty(WC_SHIPS_LIST); + + return false; } static bool ShipAccelerate(Vehicle *v) @@ -446,7 +455,7 @@ if (v->current_order.IsType(OT_LOADING)) return; - CheckShipLeaveDepot(v); + if (CheckShipLeaveDepot(v)) return; v->ShowVisualEffect();