ship_cmd.c
changeset 1530 2b46869fc0d4
parent 1520 d88442095697
child 1698 3f979f9ecf6c
equal deleted inserted replaced
1529:3a8196d15b01 1530:2b46869fc0d4
   106 
   106 
   107 	if (v->vehstatus & VS_STOPPED)
   107 	if (v->vehstatus & VS_STOPPED)
   108 		return;
   108 		return;
   109 
   109 
   110 	if (v->current_order.type == OT_GOTO_DEPOT &&
   110 	if (v->current_order.type == OT_GOTO_DEPOT &&
   111 			v->current_order.flags & OF_FULL_LOAD)
   111 			v->current_order.flags & OF_HALT_IN_DEPOT)
   112 		return;
   112 		return;
   113 
   113 
   114 	if (_patches.gotodepot && VehicleHasDepotOrders(v))
   114 	if (_patches.gotodepot && VehicleHasDepotOrders(v))
   115 		return;
   115 		return;
   116 
   116 
   428 
   428 
   429 		t = v->current_order;
   429 		t = v->current_order;
   430 		v->current_order.type = OT_DUMMY;
   430 		v->current_order.type = OT_DUMMY;
   431 		v->current_order.flags = 0;
   431 		v->current_order.flags = 0;
   432 
   432 
   433 		if (t.flags & OF_UNLOAD) {
   433 		if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
   434 			v->cur_order_index++;
   434 			v->cur_order_index++;
   435 		} else if (t.flags & OF_FULL_LOAD) {
   435 		} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
   436 			v->vehstatus |= VS_STOPPED;
   436 			v->vehstatus |= VS_STOPPED;
   437 			if (v->owner == _local_player) {
   437 			if (v->owner == _local_player) {
   438 				SetDParam(0, v->unitnumber);
   438 				SetDParam(0, v->unitnumber);
   439 				AddNewsItem(
   439 				AddNewsItem(
   440 					STR_981C_SHIP_IS_WAITING_IN_DEPOT,
   440 					STR_981C_SHIP_IS_WAITING_IN_DEPOT,
   991 	if (v->type != VEH_Ship || !CheckOwnership(v->owner))
   991 	if (v->type != VEH_Ship || !CheckOwnership(v->owner))
   992 		return CMD_ERROR;
   992 		return CMD_ERROR;
   993 
   993 
   994 	if (v->current_order.type == OT_GOTO_DEPOT) {
   994 	if (v->current_order.type == OT_GOTO_DEPOT) {
   995 		if (flags & DC_EXEC) {
   995 		if (flags & DC_EXEC) {
   996 			if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
   996 
       
   997 			if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
       
   998 				v->cur_order_index++;
       
   999 
   997 			v->current_order.type = OT_DUMMY;
  1000 			v->current_order.type = OT_DUMMY;
   998 			v->current_order.flags = 0;
  1001 			v->current_order.flags = 0;
   999 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
  1002 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
  1000 		}
  1003 		}
  1001 	} else {
  1004 	} else {
  1004 			return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
  1007 			return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
  1005 
  1008 
  1006 		if (flags & DC_EXEC) {
  1009 		if (flags & DC_EXEC) {
  1007 			v->dest_tile = depot->xy;
  1010 			v->dest_tile = depot->xy;
  1008 			v->current_order.type = OT_GOTO_DEPOT;
  1011 			v->current_order.type = OT_GOTO_DEPOT;
  1009 			v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
  1012 			v->current_order.flags = OF_NON_STOP | OF_HALT_IN_DEPOT;
  1010 			v->current_order.station = depot->index;
  1013 			v->current_order.station = depot->index;
  1011 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
  1014 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
  1012 		}
  1015 		}
  1013 	}
  1016 	}
  1014 
  1017