158 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
158 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
159 } |
159 } |
160 return; |
160 return; |
161 } |
161 } |
162 |
162 |
163 v->current_order.MakeGoToDepot(depot->index, false); |
163 v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE); |
164 v->dest_tile = depot->xy; |
164 v->dest_tile = depot->xy; |
165 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
165 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
166 } |
166 } |
167 |
167 |
168 void Ship::OnNewDay() |
168 void Ship::OnNewDay() |
941 |
941 |
942 if (v->IsInDepot()) return CMD_ERROR; |
942 if (v->IsInDepot()) return CMD_ERROR; |
943 |
943 |
944 /* If the current orders are already goto-depot */ |
944 /* If the current orders are already goto-depot */ |
945 if (v->current_order.IsType(OT_GOTO_DEPOT)) { |
945 if (v->current_order.IsType(OT_GOTO_DEPOT)) { |
946 bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT); |
946 bool halt_in_depot = v->current_order.GetDepotActionType() & ODATFB_HALT; |
947 if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) { |
947 if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) { |
948 /* We called with a different DEPOT_SERVICE setting. |
948 /* We called with a different DEPOT_SERVICE setting. |
949 * Now we change the setting to apply the new one and let the vehicle head for the same depot. |
949 * Now we change the setting to apply the new one and let the vehicle head for the same depot. |
950 * Note: the if is (true for requesting service == true for ordered to stop in depot) */ |
950 * Note: the if is (true for requesting service == true for ordered to stop in depot) */ |
951 if (flags & DC_EXEC) { |
951 if (flags & DC_EXEC) { |
952 v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER); |
952 v->current_order.SetDepotOrderType(ODTF_MANUAL); |
953 v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT); |
953 v->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT); |
954 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
954 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
955 } |
955 } |
956 return CommandCost(); |
956 return CommandCost(); |
957 } |
957 } |
958 |
958 |
959 if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders |
959 if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders |
960 if (flags & DC_EXEC) { |
960 if (flags & DC_EXEC) { |
961 /* If the orders to 'goto depot' are in the orders list (forced servicing), |
961 /* If the orders to 'goto depot' are in the orders list (forced servicing), |
962 * then skip to the next order; effectively cancelling this forced service */ |
962 * then skip to the next order; effectively cancelling this forced service */ |
963 if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++; |
963 if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) v->cur_order_index++; |
964 |
964 |
965 v->current_order.MakeDummy(); |
965 v->current_order.MakeDummy(); |
966 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
966 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
967 } |
967 } |
968 return CommandCost(); |
968 return CommandCost(); |
973 |
973 |
974 if (flags & DC_EXEC) { |
974 if (flags & DC_EXEC) { |
975 if (v->current_order.IsType(OT_LOADING)) v->LeaveStation(); |
975 if (v->current_order.IsType(OT_LOADING)) v->LeaveStation(); |
976 |
976 |
977 v->dest_tile = dep->xy; |
977 v->dest_tile = dep->xy; |
978 v->current_order.MakeGoToDepot(dep->index, false); |
978 v->current_order.MakeGoToDepot(dep->index, ODTF_MANUAL); |
979 if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT); |
979 if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(ODATFB_HALT); |
980 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
980 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); |
981 } |
981 } |
982 |
982 |
983 return CommandCost(); |
983 return CommandCost(); |
984 } |
984 } |