src/ai/default/default.cpp
changeset 8839 6337281b393b
parent 8836 f6f1ea3d7e93
child 8840 332412c2e9c1
equal deleted inserted replaced
8838:068d63397dc3 8839:6337281b393b
   316 static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
   316 static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
   317 {
   317 {
   318 	if (bak->order == NULL) return;
   318 	if (bak->order == NULL) return;
   319 
   319 
   320 	for (uint i = 0; !bak->order[i].IsType(OT_NOTHING); i++) {
   320 	for (uint i = 0; !bak->order[i].IsType(OT_NOTHING); i++) {
   321 		if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
   321 		if (!DoCommandP(0, v->index + (i << 16), bak->order[i].Pack(), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
   322 			break;
   322 			break;
   323 	}
   323 	}
   324 }
   324 }
   325 
   325 
   326 static void AiHandleReplaceTrain(Player *p)
   326 static void AiHandleReplaceTrain(Player *p)
  2556 
  2556 
  2557 		if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
  2557 		if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
  2558 		if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
  2558 		if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
  2559 			order.flags |= OFB_FULL_LOAD;
  2559 			order.flags |= OFB_FULL_LOAD;
  2560 
  2560 
  2561 		DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
  2561 		DoCommand(0, loco_id + (i << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
  2562 	}
  2562 	}
  2563 
  2563 
  2564 	DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN);
  2564 	DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN);
  2565 
  2565 
  2566 	DoCommand(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
  2566 	DoCommand(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
  3291 
  3291 
  3292 		if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
  3292 		if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
  3293 		if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
  3293 		if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
  3294 			order.flags |= OFB_FULL_LOAD;
  3294 			order.flags |= OFB_FULL_LOAD;
  3295 
  3295 
  3296 		DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
  3296 		DoCommand(0, loco_id + (i << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
  3297 	}
  3297 	}
  3298 
  3298 
  3299 	DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
  3299 	DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
  3300 	DoCommand(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
  3300 	DoCommand(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
  3301 
  3301 
  3570 
  3570 
  3571 		if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
  3571 		if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
  3572 		if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
  3572 		if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
  3573 			order.flags |= OFB_FULL_LOAD;
  3573 			order.flags |= OFB_FULL_LOAD;
  3574 
  3574 
  3575 		DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
  3575 		DoCommand(0, loco_id + (i << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
  3576 	}
  3576 	}
  3577 
  3577 
  3578 	DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
  3578 	DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
  3579 
  3579 
  3580 	DoCommand(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);
  3580 	DoCommand(0, loco_id, _ai_service_interval, DC_EXEC, CMD_CHANGE_SERVICE_INT);