(svn r11250) [NoAI] -Fix [API CHANGE]: SkipVehicleOrder always skipped to first vehicle order.. replaced with SkipToVehicleOrder, and added a param to specify to which order it should skip (dynaxo)
--- a/src/ai/api/ai_vehicle.cpp Sun Oct 07 00:40:14 2007 +0000
+++ b/src/ai/api/ai_vehicle.cpp Fri Oct 12 22:04:41 2007 +0000
@@ -4,6 +4,7 @@
#include "ai_vehicle.hpp"
#include "ai_cargo.hpp"
+#include "ai_order.hpp"
#include "../../command.h"
#include "../../vehicle.h"
#include "../../depot.h"
@@ -184,11 +185,11 @@
}
}
-bool AIVehicle::SkipVehicleOrder(VehicleID vehicle_id)
+bool AIVehicle::SkipToVehicleOrder(VehicleID vehicle_id, uint32 order_id)
{
- if (!this->IsValidVehicle(vehicle_id)) return false;
+ if (!AIOrder::IsValidVehicleOrder(vehicle_id, order_id)) return false;
- return this->DoCommand(0, vehicle_id, 0, CMD_SKIP_TO_ORDER);
+ return this->DoCommand(0, vehicle_id, order_id, CMD_SKIP_TO_ORDER);
}
bool AIVehicle::SetName(VehicleID vehicle_id, const char *name)
--- a/src/ai/api/ai_vehicle.hpp Sun Oct 07 00:40:14 2007 +0000
+++ b/src/ai/api/ai_vehicle.hpp Fri Oct 12 22:04:41 2007 +0000
@@ -157,10 +157,11 @@
/**
* Skips the current order of the given vehicle.
* @param vehicle_id the vehicle to skip the order for.
- * @pre IsValidVehicle(vehicle_id).
+ * @param order_id the selected order to which we want to skip.
+ * @pre IsValidVehicleOrder(vehicle_id, order_id).
* @return true if and only if the order has been skipped.
*/
- bool SkipVehicleOrder(VehicleID vehicle_id);
+ bool SkipToVehicleOrder(VehicleID vehicle_id, uint32 order_id);
/**
* Set the name of a vehicle.
--- a/src/ai/api/ai_vehicle.hpp.sq Sun Oct 07 00:40:14 2007 +0000
+++ b/src/ai/api/ai_vehicle.hpp.sq Fri Oct 12 22:04:41 2007 +0000
@@ -47,7 +47,7 @@
SQAIVehicle.DefSQMethod(engine, &AIVehicle::SellVehicle, "SellVehicle", 2, "xi");
SQAIVehicle.DefSQMethod(engine, &AIVehicle::SendVehicleToDepot, "SendVehicleToDepot", 2, "xi");
SQAIVehicle.DefSQMethod(engine, &AIVehicle::StartStopVehicle, "StartStopVehicle", 2, "xi");
- SQAIVehicle.DefSQMethod(engine, &AIVehicle::SkipVehicleOrder, "SkipVehicleOrder", 2, "xi");
+ SQAIVehicle.DefSQMethod(engine, &AIVehicle::SkipToVehicleOrder, "SkipToVehicleOrder", 3, "xii");
SQAIVehicle.DefSQMethod(engine, &AIVehicle::SetName, "SetName", 3, "xis");
SQAIVehicle.PostRegister(engine);