aircraft_cmd.c
changeset 4510 54d30a2372c3
parent 4506 e6a56518135c
child 4519 f53d829de680
equal deleted inserted replaced
4509:e6c048cb7692 4510:54d30a2372c3
   510 	v = GetVehicle(p1);
   510 	v = GetVehicle(p1);
   511 
   511 
   512 	if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
   512 	if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
   513 
   513 
   514 	if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
   514 	if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
       
   515 		if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
       
   516 			/* We called with a different DEPOT_SERVICE setting.
       
   517 			 * Now we change the setting to apply the new one and let the vehicle head for the same hangar.
       
   518 			 * Note: the if is (true for requesting service == true for ordered to stop in hangar)          */
       
   519 			if (flags & DC_EXEC) {
       
   520 				TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
       
   521 				InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
       
   522 			}
       
   523 			return 0;
       
   524 		}
       
   525 
   515 		if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
   526 		if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
   516 		if (flags & DC_EXEC) {
   527 		if (flags & DC_EXEC) {
   517 			if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
   528 			if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
   518 			v->current_order.type = OT_DUMMY;
   529 			v->current_order.type = OT_DUMMY;
   519 			v->current_order.flags = 0;
   530 			v->current_order.flags = 0;