(svn r16260) -Codechange: Add Vehicle::IncrementOrderIndex() to deduplicate some code.

This commit is contained in:
frosch
2009-05-09 13:37:18 +00:00
parent a8aa4e2148
commit 677ea100b3
6 changed files with 27 additions and 20 deletions

View File

@@ -1067,7 +1067,7 @@ void VehicleEnterDepot(Vehicle *v)
if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
/* Part of orders */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
v->IncrementOrderIndex();
}
if (t.GetDepotActionType() & ODATFB_HALT) {
/* Vehicles are always stopped on entering depots. Do not restart this one. */
@@ -1577,8 +1577,7 @@ void Vehicle::HandleLoading(bool mode)
default: return;
}
this->cur_order_index++;
InvalidateVehicleOrder(this, 0);
this->IncrementOrderIndex();
}
CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
@@ -1605,7 +1604,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
if (this->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) this->cur_order_index++;
if (this->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) this->IncrementOrderIndex();
this->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);