src/order_type.h
branchnoai
changeset 10142 56ee7da4ad56
parent 9869 6404afe43575
equal deleted inserted replaced
10096:780921b39016 10142:56ee7da4ad56
    25 	OT_GOTO_DEPOT    = 2,
    25 	OT_GOTO_DEPOT    = 2,
    26 	OT_LOADING       = 3,
    26 	OT_LOADING       = 3,
    27 	OT_LEAVESTATION  = 4,
    27 	OT_LEAVESTATION  = 4,
    28 	OT_DUMMY         = 5,
    28 	OT_DUMMY         = 5,
    29 	OT_GOTO_WAYPOINT = 6,
    29 	OT_GOTO_WAYPOINT = 6,
       
    30 	OT_CONDITIONAL   = 7,
    30 	OT_END
    31 	OT_END
    31 };
    32 };
    32 
    33 
    33 /* It needs to be 8bits, because we save and load it as such */
    34 /* It needs to be 8bits, because we save and load it as such */
    34 /** Define basic enum properties */
    35 /** Define basic enum properties */
    35 template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BEGIN, OT_END, OT_END> {};
    36 template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BEGIN, OT_END, OT_END> {};
    36 typedef TinyEnumT<OrderType> OrderTypeByte;
    37 typedef TinyEnumT<OrderType> OrderTypeByte;
    37 
    38 
    38 
    39 
    39 /* Order flags -- please use OF instead OF and use HASBIT/SETBIT/CLEARBIT */
    40 /**
    40 
    41  * Flags related to the unloading order.
    41 /** Order flag masks - these are for direct bit operations */
    42  */
    42 enum OrderFlagMasks {
    43 enum OrderUnloadFlags {
    43 	//Flags for stations:
    44 	OUF_UNLOAD_IF_POSSIBLE = 0,      ///< Unload all cargo that the station accepts.
    44 	/** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */
    45 	OUFB_UNLOAD            = 1 << 0, ///< Force unloading all cargo onto the platform, possibly not getting paid.
    45 	OFB_TRANSFER           = 0x1,
    46 	OUFB_TRANSFER          = 1 << 1, ///< Transfer all cargo onto the platform.
    46 	/** If OFB_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station.
    47 	OUFB_NO_UNLOAD         = 1 << 2, ///< Totally no unloading will be done.
    47       * No new cargo is loaded onto the vehicle whatsoever */
       
    48 	OFB_UNLOAD             = 0x2,
       
    49 	/** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting
       
    50 	  * @todo make this two different flags */
       
    51 	OFB_FULL_LOAD          = 0x4,
       
    52 
       
    53 	//Flags for depots:
       
    54 	/** The current depot-order was initiated because it was in the vehicle's order list */
       
    55 	OFB_MANUAL_ORDER       = 0x0,
       
    56 	OFB_PART_OF_ORDERS     = 0x2,
       
    57 	/** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
       
    58  	OFB_NORMAL_ACTION      = 0x0,
       
    59 	OFB_HALT_IN_DEPOT      = 0x4,
       
    60 	/** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
       
    61 	OFB_SERVICE_IF_NEEDED  = 0x4, //used when OFB_PART_OF_ORDERS is set.
       
    62 
       
    63 	//Common flags
       
    64 	/** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings)
       
    65 	  * @todo make this two different flags */
       
    66 	OFB_NO_NON_STOP        = 0x0,
       
    67 	OFB_NON_STOP           = 0x8
       
    68 };
    48 };
    69 
    49 
    70 /** Order flags bits - these are for the *BIT macros
    50 /**
    71  * for descrption of flags, see OrderFlagMasks
    51  * Flags related to the loading order.
    72  * @see OrderFlagMasks
       
    73  */
    52  */
    74 enum {
    53 enum OrderLoadFlags {
    75 	OF_TRANSFER          = 0,
    54 	OLF_LOAD_IF_POSSIBLE = 0,      ///< Load as long as there is cargo that fits in the train.
    76 	OF_UNLOAD            = 1,
    55 	OLFB_FULL_LOAD       = 1 << 1, ///< Full load the complete the consist.
    77 	OF_FULL_LOAD         = 2,
    56 	OLF_FULL_LOAD_ANY    = 3,      ///< Full load the a single cargo of the consist.
    78 	OF_PART_OF_ORDERS    = 1,
    57 	OLFB_NO_LOAD         = 4,      ///< Do not load anything.
    79 	OF_HALT_IN_DEPOT     = 2,
    58 };
    80 	OF_SERVICE_IF_NEEDED = 2,
    59 
    81 	OF_NON_STOP          = 3
    60 /**
       
    61  * Non-stop order flags.
       
    62  */
       
    63 enum OrderNonStopFlags {
       
    64 	ONSF_STOP_EVERYWHERE                  = 0, ///< The vehicle will stop at any station it passes and the destination.
       
    65 	ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1, ///< The vehicle will not stop at any stations it passes except the destination.
       
    66 	ONSF_NO_STOP_AT_DESTINATION_STATION   = 2, ///< The vehicle will stop at any station it passes except the destination.
       
    67 	ONSF_NO_STOP_AT_ANY_STATION           = 3, ///< The vehicle will not stop at any stations it passes including the destination.
       
    68 	ONSF_END
       
    69 };
       
    70 
       
    71 /**
       
    72  * Reasons that could cause us to go to the depot.
       
    73  */
       
    74 enum OrderDepotTypeFlags {
       
    75 	ODTF_MANUAL          = 0,      ///< The player initiated this order manually.
       
    76 	ODTFB_SERVICE        = 1 << 0, ///< This depot order is because of the servicing limit.
       
    77 	ODTFB_PART_OF_ORDERS = 1 << 1, ///< This depot order is because of a regular order.
       
    78 };
       
    79 
       
    80 /**
       
    81  * Actions that can be performed when the vehicle enters the depot.
       
    82  */
       
    83 enum OrderDepotActionFlags {
       
    84 	ODATF_SERVICE_ONLY   = 0,      ///< Only service the vehicle.
       
    85 	ODATFB_HALT          = 1 << 0, ///< Service the vehicle and then halt it.
       
    86 	ODATFB_NEAREST_DEPOT = 1 << 1, ///< Send the vehicle to the nearest depot.
       
    87 };
       
    88 
       
    89 /**
       
    90  * Variables (of a vehicle) to 'cause' skipping on.
       
    91  */
       
    92 enum OrderConditionVariable {
       
    93 	OCV_LOAD_PERCENTAGE,  ///< Skip based on the amount of load
       
    94 	OCV_RELIABILITY,      ///< Skip based on the reliability
       
    95 	OCV_MAX_SPEED,        ///< Skip based on the maximum speed
       
    96 	OCV_AGE,              ///< Skip based on the age
       
    97 	OCV_REQUIRES_SERVICE, ///< Skip when the vehicle requires service
       
    98 	OCV_UNCONDITIONALLY,  ///< Always skip
       
    99 	OCV_END
       
   100 };
       
   101 
       
   102 /**
       
   103  * Comparator for the skip reasoning.
       
   104  */
       
   105 enum OrderConditionComparator {
       
   106 	OCC_EQUALS,      ///< Skip if both values are equal
       
   107 	OCC_NOT_EQUALS,  ///< Skip if both values are not equal
       
   108 	OCC_LESS_THAN,   ///< Skip if the value is less than the limit
       
   109 	OCC_LESS_EQUALS, ///< Skip if the value is less or equal to the limit
       
   110 	OCC_MORE_THAN,   ///< Skip if the value is more than the limit
       
   111 	OCC_MORE_EQUALS, ///< Skip if the value is more or equal to the limit
       
   112 	OCC_IS_TRUE,     ///< Skip if the variable is true
       
   113 	OCC_IS_FALSE,    ///< Skip if the variable is false
       
   114 	OCC_END
       
   115 };
       
   116 
       
   117 
       
   118 /**
       
   119  * Enumeration for the data to set in CmdModifyOrder.
       
   120  */
       
   121 enum ModifyOrderFlags {
       
   122 	MOF_NON_STOP,        ///< Passes a OrderNonStopFlags.
       
   123 	MOF_UNLOAD,          ///< Passes an OrderUnloadType.
       
   124 	MOF_LOAD,            ///< Passes an OrderLoadType
       
   125 	MOF_DEPOT_ACTION,    ///< Toggle the 'service' if needed flag.
       
   126 	MOF_COND_VARIABLE,   ///< A conditional variable changes.
       
   127 	MOF_COND_COMPARATOR, ///< A comparator changes.
       
   128 	MOF_COND_VALUE,      ///< The value to set the condition to.
       
   129 	MOF_END
    82 };
   130 };
    83 
   131 
    84 
   132 
    85 /* Possible clone options */
   133 /* Possible clone options */
    86 enum {
   134 enum {