diff options
author | yexo <yexo@openttd.org> | 2010-02-04 23:18:19 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-02-04 23:18:19 +0000 |
commit | 091d88f5143601a456c3688ff9305f144a5ed6e2 (patch) | |
tree | 54471dd005dd9a741cd3692537eda46f80274530 /src/ai/api/ai_order.hpp | |
parent | d858264ca64c09802792457888e6f3506fada46d (diff) | |
download | openttd-091d88f5143601a456c3688ff9305f144a5ed6e2.tar.xz |
(svn r19014) -Add: [NoAI] AIOrder::[G|S]etStopLocation to get/set the stop location of trains in a rail station
Diffstat (limited to 'src/ai/api/ai_order.hpp')
-rw-r--r-- | src/ai/api/ai_order.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ai/api/ai_order.hpp b/src/ai/api/ai_order.hpp index 53ce0d261..fe0dcd826 100644 --- a/src/ai/api/ai_order.hpp +++ b/src/ai/api/ai_order.hpp @@ -118,6 +118,14 @@ public: ORDER_INVALID = -1, //!< An invalid order. }; + /** Where to stop trains in a station that's longer then the train */ + enum StopLocation { + STOPLOCATION_NEAR, //!< Stop the train as soon as it's completely in the station + STOPLOCATION_MIDDLE, //!< Stop the train in the middle of the station + STOPLOCATION_FAR, //!< Stop the train at the far end of the station + STOPLOCATION_INVALID = -1, //!< An invalid stop location + }; + /** * Checks whether the given order id is valid for the given vehicle. * @param vehicle_id The vehicle to check the order index for. @@ -282,6 +290,17 @@ public: static int32 GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position); /** + * Gets the stoplocation of the given order for the given train. + * @param vehicle_id The vehicle to get the value for. + * @param order_position The order to get the value for. + * @pre IsValidVehicleOrder(vehicle_id, order_position). + * @pre AIVehicle::GetVehicleType(vehicle_id) == AIVehicle::VT_RAIL. + * @pre IsGotoStationOrder(vehicle_id, order_position). + * @return The relative position where the train will stop inside a station. + */ + static StopLocation GetStopLocation(VehicleID vehicle_id, OrderPosition order_position); + + /** * Sets the OrderPosition to jump to if the check succeeds of the given order for the given vehicle. * @param vehicle_id The vehicle to set the OrderPosition for. * @param order_position The order to set the OrderPosition for. @@ -330,6 +349,17 @@ public: static bool SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, int32 value); /** + * Sets the stoplocation of the given order for the given train. + * @param vehicle_id The vehicle to get the value for. + * @param order_position The order to get the value for. + * @pre IsValidVehicleOrder(vehicle_id, order_position). + * @pre AIVehicle::GetVehicleType(vehicle_id) == AIVehicle::VT_RAIL. + * @pre IsGotoStationOrder(vehicle_id, order_position). + * @return Whether the order has been/can be changed. + */ + static bool SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location); + + /** * Appends an order to the end of the vehicle's order list. * @param vehicle_id The vehicle to append the order to. * @param destination The destination of the order. |