ship_cmd.c
changeset 4510 54d30a2372c3
parent 4506 e6a56518135c
child 4519 f53d829de680
equal deleted inserted replaced
4509:e6c048cb7692 4510:54d30a2372c3
  1018 
  1018 
  1019 	if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
  1019 	if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
  1020 
  1020 
  1021 	/* If the current orders are already goto-depot */
  1021 	/* If the current orders are already goto-depot */
  1022 	if (v->current_order.type == OT_GOTO_DEPOT) {
  1022 	if (v->current_order.type == OT_GOTO_DEPOT) {
       
  1023 		if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
       
  1024 			/* We called with a different DEPOT_SERVICE setting.
       
  1025 			 * Now we change the setting to apply the new one and let the vehicle head for the same depot.
       
  1026 			 * Note: the if is (true for requesting service == true for ordered to stop in depot)          */
       
  1027 			if (flags & DC_EXEC) {
       
  1028 				TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
       
  1029 				InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
       
  1030 			}
       
  1031 			return 0;
       
  1032 		}
       
  1033 
  1023 		if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
  1034 		if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
  1024 		if (flags & DC_EXEC) {
  1035 		if (flags & DC_EXEC) {
  1025 			/* If the orders to 'goto depot' are in the orders list (forced servicing),
  1036 			/* If the orders to 'goto depot' are in the orders list (forced servicing),
  1026 			 * then skip to the next order; effectively cancelling this forced service */
  1037 			 * then skip to the next order; effectively cancelling this forced service */
  1027 			if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
  1038 			if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))