mirror of https://github.com/OpenTTD/OpenTTD
(svn r15684) -Add [NoAI]: AIOrder::SkipToOrder().
parent
9eef8f77e2
commit
cef662825b
|
@ -91,6 +91,7 @@ public:
|
|||
/**
|
||||
* Insert an event to the queue for the company.
|
||||
* @param event The event to insert.
|
||||
* @note DO NOT CALL YOURSELF; leave it to the internal AI programming.
|
||||
*/
|
||||
static void InsertEvent(AIEvent *event);
|
||||
|
||||
|
|
|
@ -306,6 +306,13 @@ static OrderType GetOrderTypeByTile(TileIndex t)
|
|||
return AIObject::DoCommand(0, vehicle_id, order_position, CMD_DELETE_ORDER);
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::SkipToOrder(VehicleID vehicle_id, OrderPosition next_order)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, next_order));
|
||||
|
||||
return AIObject::DoCommand(0, vehicle_id, next_order, CMD_SKIP_TO_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback handler as SetOrderFlags possibly needs multiple DoCommand calls
|
||||
* to be able to set all order flags correctly. As we need to wait till the
|
||||
|
|
|
@ -331,7 +331,7 @@ public:
|
|||
* Removes an order from the vehicle's order list.
|
||||
* @param vehicle_id The vehicle to remove the order from.
|
||||
* @param order_position The order to remove from the order list.
|
||||
* @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
|
||||
* @return True if and only if the order was removed.
|
||||
*/
|
||||
|
@ -377,6 +377,16 @@ public:
|
|||
*/
|
||||
static bool MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target);
|
||||
|
||||
/**
|
||||
* Make a vehicle execute next_order instead of its current order.
|
||||
* @param vehicle_id The vehicle that should skip some orders.
|
||||
* @param next_order The order the vehicle should skip to.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, next_order).
|
||||
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
|
||||
* @return True if and only the current order was changed.
|
||||
*/
|
||||
static bool SkipToOrder(VehicleID vehicle_id, OrderPosition next_order);
|
||||
|
||||
/**
|
||||
* Copies the orders from another vehicle. The orders of the main vehicle
|
||||
* are going to be the orders of the changed vehicle.
|
||||
|
|
|
@ -95,6 +95,7 @@ void SQAIOrder_Register(Squirrel *engine) {
|
|||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags, "SetOrderFlags", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ChangeOrder, "ChangeOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder, "MoveOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder, "SkipToOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders, "CopyOrders", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders, "ShareOrders", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders, "UnshareOrders", 2, ".i");
|
||||
|
|
Loading…
Reference in New Issue