diff options
author | michi_cc <michi_cc@openttd.org> | 2011-12-13 00:43:59 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-12-13 00:43:59 +0000 |
commit | a085ea9e4b9078c647304e85d4c03980b71ced22 (patch) | |
tree | 0402e72db8caaf57ca38b3dd71312f9375eb389c /src/script/api/script_order.hpp | |
parent | 34ffd08a19e1156260223256d87a4cdfa7a080e0 (diff) | |
download | openttd-a085ea9e4b9078c647304e85d4c03980b71ced22.tar.xz |
(svn r23506) -Add: [NoAI] Support for dealing with aircraft range.
Diffstat (limited to 'src/script/api/script_order.hpp')
-rw-r--r-- | src/script/api/script_order.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/script/api/script_order.hpp b/src/script/api/script_order.hpp index bc9d25493..7eac7783a 100644 --- a/src/script/api/script_order.hpp +++ b/src/script/api/script_order.hpp @@ -13,6 +13,7 @@ #define SCRIPT_ORDER_HPP #include "script_error.hpp" +#include "script_vehicle.hpp" /** * Class that handles all order related functions. @@ -32,6 +33,9 @@ public: /** Destination of new order is to far away from the previous order */ ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, // [STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION] + + /* Aircraft has not enough range to copy/share orders. */ + ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, // [STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE] }; /** @@ -532,6 +536,7 @@ public: * @pre ScriptVehicle::IsValidVehicle(main_vehicle_id). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptOrder::ERR_ORDER_TOO_MANY + * @exception ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE * @return True if and only if the copying succeeded. */ static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); @@ -544,6 +549,7 @@ public: * @pre ScriptVehicle::IsValidVehicle(vehicle_id). * @pre ScriptVehicle::IsValidVehicle(main_vehicle_id). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY + * @exception ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE * @return True if and only if the sharing succeeded. */ static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); @@ -555,6 +561,16 @@ public: * @return True if and only if the unsharing succeeded. */ static bool UnshareOrders(VehicleID vehicle_id); + + /** + * Get the distance between two points for a vehicle type. + * @param vehicle_type The vehicle type to get the distance for. + * @param origin_tile Origin, can be any tile or a tile of a specific station. + * @param dest_tile Destination, ca be any tile or a tile of a specific station. + * @return The distance between the origin and the destination for a vehicle of the given vehicle type. + * @see ScriptEngine::GetMaximumOrderDistance and ScriptVehicle::GetMaximumOrderDistance + */ + static uint GetOrderDistance(ScriptVehicle::VehicleType vehicle_type, TileIndex origin_tile, TileIndex dest_tile); }; DECLARE_ENUM_AS_BIT_SET(ScriptOrder::ScriptOrderFlags) |