src/order_type.h
branchNewGRF_ports
changeset 10184 fcf5fb2548eb
child 10192 195d7f6dcf71
equal deleted inserted replaced
10179:eec5a7dcbf61 10184:fcf5fb2548eb
       
     1 /* $Id$ */
       
     2 
       
     3 /** @file order_type.h Types related to orders. */
       
     4 
       
     5 #ifndef ORDER_TYPE_H
       
     6 #define ORDER_TYPE_H
       
     7 
       
     8 #include "core/enum_type.hpp"
       
     9 
       
    10 typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
       
    11 typedef uint16 OrderID;
       
    12 typedef uint16 DestinationID;
       
    13 
       
    14 enum {
       
    15 	INVALID_VEH_ORDER_ID = 0xFF,
       
    16 };
       
    17 
       
    18 static const OrderID INVALID_ORDER = 0xFFFF;
       
    19 
       
    20 /* Order types */
       
    21 enum OrderType {
       
    22 	OT_BEGIN         = 0,
       
    23 	OT_NOTHING       = 0,
       
    24 	OT_GOTO_STATION  = 1,
       
    25 	OT_GOTO_DEPOT    = 2,
       
    26 	OT_LOADING       = 3,
       
    27 	OT_LEAVESTATION  = 4,
       
    28 	OT_DUMMY         = 5,
       
    29 	OT_GOTO_WAYPOINT = 6,
       
    30 	OT_END
       
    31 };
       
    32 
       
    33 /* It needs to be 8bits, because we save and load it as such */
       
    34 /** Define basic enum properties */
       
    35 template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BEGIN, OT_END, OT_END> {};
       
    36 typedef TinyEnumT<OrderType> OrderTypeByte;
       
    37 
       
    38 
       
    39 /**
       
    40  * Flags related to the unloading order.
       
    41  */
       
    42 enum OrderUnloadFlags {
       
    43 	OUF_UNLOAD_IF_POSSIBLE = 0,      ///< Unload all cargo that the station accepts.
       
    44 	OUFB_TRANSFER          = 1 << 0, ///< Transfer all cargo onto the platform.
       
    45 	OUFB_UNLOAD            = 1 << 1, ///< Force unloading all cargo onto the platform, possibly not getting paid.
       
    46 	OUFB_NO_UNLOAD         = 1 << 2, ///< Totally no unloading will be done.
       
    47 };
       
    48 
       
    49 /**
       
    50  * Flags related to the loading order.
       
    51  */
       
    52 enum OrderLoadFlags {
       
    53 	OLF_LOAD_IF_POSSIBLE = 0,      ///< Load as long as there is cargo that fits in the train.
       
    54 	OLFB_FULL_LOAD       = 1 << 2, ///< Full load the complete the consist.
       
    55 	OLF_FULL_LOAD_ANY    = 5,      ///< Full load the a single cargo of the consist.
       
    56 };
       
    57 
       
    58 /**
       
    59  * Non-stop order flags.
       
    60  */
       
    61 enum OrderNonStopFlags {
       
    62 	ONSF_STOP_EVERYWHERE                  = 0, ///< The vehicle will stop at any station it passes and the destination.
       
    63 	ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1, ///< The vehicle will not stop at any stations it passes except the destination.
       
    64 	ONSF_NO_STOP_AT_DESTINATION_STATION   = 2, ///< The vehicle will stop at any station it passes except the destination.
       
    65 	ONSF_NO_STOP_AT_ANY_STATION           = 3, ///< The vehicle will not stop at any stations it passes including the destination.
       
    66 	ONSF_END
       
    67 };
       
    68 
       
    69 /**
       
    70  * Reasons that could cause us to go to the depot.
       
    71  */
       
    72 enum OrderDepotTypeFlags {
       
    73 	ODTF_MANUAL          = 0,      ///< The player initiated this order manually.
       
    74 	ODTFB_SERVICE        = 1 << 2, ///< This depot order is because of the servicing limit.
       
    75 	ODTFB_PART_OF_ORDERS = 1 << 1, ///< This depot order is because of a regular order.
       
    76 };
       
    77 
       
    78 /**
       
    79  * Actions that can be performed when the vehicle enters the depot.
       
    80  */
       
    81 enum OrderDepotActionFlags {
       
    82 	ODATF_SERVICE_ONLY   = 0,      ///< Only service the vehicle.
       
    83 	ODATFB_HALT          = 1 << 2, ///< Service the vehicle and then halt it.
       
    84 };
       
    85 
       
    86 /**
       
    87  * Enumeration for the data to set in CmdModifyOrder.
       
    88  */
       
    89 enum ModifyOrderFlags {
       
    90 	MOF_NON_STOP,      ///< Passes a OrderNonStopFlags.
       
    91 	MOF_UNLOAD,        ///< Passes an OrderUnloadType.
       
    92 	MOF_LOAD,          ///< Passes an OrderLoadType
       
    93 	MOF_DEPOT_ACTION,  ///< Toggle the 'service' if needed flag.
       
    94 };
       
    95 
       
    96 
       
    97 /* Possible clone options */
       
    98 enum {
       
    99 	CO_SHARE   = 0,
       
   100 	CO_COPY    = 1,
       
   101 	CO_UNSHARE = 2
       
   102 };
       
   103 
       
   104 struct Order;
       
   105 
       
   106 #endif /* ORDER_TYPE_H */