diff options
-rw-r--r-- | src/ai/api/ai_order.cpp | 4 | ||||
-rw-r--r-- | src/order_base.h | 15 | ||||
-rw-r--r-- | src/order_cmd.cpp | 8 | ||||
-rw-r--r-- | src/order_gui.cpp | 15 |
4 files changed, 21 insertions, 21 deletions
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp index fa397e6c0..20733c4f9 100644 --- a/src/ai/api/ai_order.cpp +++ b/src/ai/api/ai_order.cpp @@ -340,10 +340,10 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or * to a depot (other vehicle types). */ if (::GetVehicle(vehicle_id)->type == VEH_AIRCRAFT) { if (!::IsTileType(destination, MP_STATION)) return false; - order.MakeGoToDepot(::GetStationIndex(destination), odtf, odaf); + order.MakeGoToDepot(::GetStationIndex(destination), odtf, ONSF_STOP_EVERYWHERE, odaf); } else { if (::IsTileType(destination, MP_STATION)) return false; - order.MakeGoToDepot(::GetDepotByTile(destination)->index, odtf, odaf); + order.MakeGoToDepot(::GetDepotByTile(destination)->index, odtf, ONSF_STOP_EVERYWHERE, odaf); } break; } diff --git a/src/order_base.h b/src/order_base.h index 7b0f0ab13..029413ee0 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -83,13 +83,14 @@ public: /** * Makes this order a Go To Depot order. - * @param destination the depot to go to. - * @param order is this order a 'default' order, or an overriden vehicle order? - * @param action what to do in the depot? - * @param cargo the cargo type to change to. - * @param subtype the subtype to change to. - */ - void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT, byte subtype = 0); + * @param destination the depot to go to. + * @param order is this order a 'default' order, or an overriden vehicle order? + * @param non_stop_type how to get to the depot? + * @param action what to do in the depot? + * @param cargo the cargo type to change to. + * @param subtype the subtype to change to. + */ + void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type = ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT, byte subtype = 0); /** * Makes this order a Go To Waypoint order. diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index b89c7ff89..18a8ef73f 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -51,14 +51,12 @@ void Order::MakeGoToStation(StationID destination) this->dest = destination; } -void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderDepotActionFlags action, CargoID cargo, byte subtype) +void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type, OrderDepotActionFlags action, CargoID cargo, byte subtype) { this->type = OT_GOTO_DEPOT; this->SetDepotOrderType(order); this->SetDepotActionType(action); - if (!(order & ODTFB_PART_OF_ORDERS)) { - this->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); - } + this->SetNonStopType(non_stop_type); this->dest = destination; this->SetRefit(cargo, subtype); } @@ -1644,7 +1642,7 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth) if (v->FindClosestDepot(&location, &destination, &reverse)) { v->dest_tile = location; - v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), (OrderDepotActionFlags)(v->current_order.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype()); + v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), v->current_order.GetNonStopType(), (OrderDepotActionFlags)(v->current_order.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype()); /* 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); diff --git a/src/order_gui.cpp b/src/order_gui.cpp index d9d54547e..fd925f838 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -299,9 +299,9 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) case MP_RAILWAY: if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_company)) { if (IsRailDepot(tile)) { - order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); + order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS, + _settings_client.gui.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); - if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); return order; } } @@ -309,9 +309,9 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) case MP_ROAD: if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_company)) { - order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); + order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS, + _settings_client.gui.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); - if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); return order; } break; @@ -319,7 +319,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) case MP_STATION: if (v->type != VEH_AIRCRAFT) break; if (IsHangar(tile) && IsTileOwner(tile, _local_company)) { - order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS); + order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS, ONSF_STOP_EVERYWHERE); if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); return order; } @@ -330,7 +330,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) if (IsShipDepot(tile) && IsTileOwner(tile, _local_company)) { TileIndex tile2 = GetOtherShipDepotTile(tile); - order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS); + order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS, ONSF_STOP_EVERYWHERE); if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); return order; } @@ -507,7 +507,8 @@ private: Order order; order.next = NULL; order.index = 0; - order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS); + order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS, + _settings_client.gui.new_nonstop && (w->vehicle->type == VEH_TRAIN || w->vehicle->type == VEH_ROAD) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); order.SetDepotActionType(ODATFB_NEAREST_DEPOT); DoCommandP(w->vehicle->tile, w->vehicle->index + (w->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER)); |