Merge branch 'master' into jgrpp
# Conflicts: # src/lang/czech.txt # src/lang/galician.txt # src/lang/german.txt # src/order_cmd.cpp # src/saveload/afterload.cpp # src/ship.h # src/vehicle.cpp
This commit is contained in:
@@ -3226,23 +3226,21 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth, bool
|
||||
|
||||
if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
|
||||
/* We need to search for the nearest depot (hangar). */
|
||||
TileIndex location;
|
||||
DestinationID destination;
|
||||
bool reverse;
|
||||
ClosestDepot closestDepot = v->FindClosestDepot();
|
||||
|
||||
if (v->FindClosestDepot(&location, &destination, &reverse)) {
|
||||
if (closestDepot.found) {
|
||||
/* PBS reservations cannot reverse */
|
||||
if (pbs_look_ahead && reverse) return false;
|
||||
if (pbs_look_ahead && closestDepot.reverse) return false;
|
||||
|
||||
v->SetDestTile(location);
|
||||
v->current_order.SetDestination(destination);
|
||||
v->SetDestTile(closestDepot.location);
|
||||
v->current_order.SetDestination(closestDepot.destination);
|
||||
|
||||
/* If there is no depot in front, reverse automatically (trains only) */
|
||||
if (v->type == VEH_TRAIN && reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
|
||||
if (v->type == VEH_TRAIN && closestDepot.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
|
||||
|
||||
if (v->type == VEH_AIRCRAFT) {
|
||||
Aircraft *a = Aircraft::From(v);
|
||||
if (a->state == FLYING && a->targetairport != destination) {
|
||||
if (a->state == FLYING && a->targetairport != closestDepot.destination) {
|
||||
/* The aircraft is now heading for a different hangar than the next in the orders */
|
||||
extern void AircraftNextAirportPos_and_Order(Aircraft *a);
|
||||
AircraftNextAirportPos_and_Order(a);
|
||||
|
Reference in New Issue
Block a user