rubidium@8771: /* $Id$ */ rubidium@8771: rubidium@8771: /** @file order_type.h Types related to orders. */ rubidium@8771: rubidium@8771: #ifndef ORDER_TYPE_H rubidium@8771: #define ORDER_TYPE_H rubidium@8771: rubidium@8771: #include "core/enum_type.hpp" rubidium@8771: rubidium@8771: typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related) rubidium@8771: typedef uint16 OrderID; rubidium@8776: typedef uint16 DestinationID; rubidium@8771: rubidium@8771: enum { rubidium@8771: INVALID_VEH_ORDER_ID = 0xFF, rubidium@8771: }; rubidium@8771: rubidium@8771: static const OrderID INVALID_ORDER = 0xFFFF; rubidium@8771: rubidium@8771: /* Order types */ rubidium@8771: enum OrderType { rubidium@8771: OT_BEGIN = 0, rubidium@8771: OT_NOTHING = 0, rubidium@8771: OT_GOTO_STATION = 1, rubidium@8771: OT_GOTO_DEPOT = 2, rubidium@8771: OT_LOADING = 3, rubidium@8771: OT_LEAVESTATION = 4, rubidium@8771: OT_DUMMY = 5, rubidium@8771: OT_GOTO_WAYPOINT = 6, rubidium@8900: OT_CONDITIONAL = 7, rubidium@8771: OT_END rubidium@8771: }; rubidium@8771: rubidium@8771: /* It needs to be 8bits, because we save and load it as such */ rubidium@8771: /** Define basic enum properties */ rubidium@8771: template <> struct EnumPropsT : MakeEnumPropsT {}; rubidium@8771: typedef TinyEnumT OrderTypeByte; rubidium@8771: rubidium@8771: rubidium@8855: /** rubidium@8855: * Flags related to the unloading order. rubidium@8855: */ rubidium@8855: enum OrderUnloadFlags { rubidium@8855: OUF_UNLOAD_IF_POSSIBLE = 0, ///< Unload all cargo that the station accepts. rubidium@8881: OUFB_UNLOAD = 1 << 0, ///< Force unloading all cargo onto the platform, possibly not getting paid. rubidium@8881: OUFB_TRANSFER = 1 << 1, ///< Transfer all cargo onto the platform. rubidium@8876: OUFB_NO_UNLOAD = 1 << 2, ///< Totally no unloading will be done. rubidium@8855: }; rubidium@8771: rubidium@8855: /** rubidium@8855: * Flags related to the loading order. rubidium@8855: */ rubidium@8855: enum OrderLoadFlags { rubidium@8855: OLF_LOAD_IF_POSSIBLE = 0, ///< Load as long as there is cargo that fits in the train. rubidium@8881: OLFB_FULL_LOAD = 1 << 1, ///< Full load the complete the consist. rubidium@8881: OLF_FULL_LOAD_ANY = 3, ///< Full load the a single cargo of the consist. rubidium@8883: OLFB_NO_LOAD = 4, ///< Do not load anything. rubidium@8848: }; rubidium@8771: rubidium@8848: /** rubidium@8848: * Non-stop order flags. rubidium@8848: */ rubidium@8848: enum OrderNonStopFlags { rubidium@8855: ONSF_STOP_EVERYWHERE = 0, ///< The vehicle will stop at any station it passes and the destination. rubidium@8855: ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1, ///< The vehicle will not stop at any stations it passes except the destination. rubidium@8855: ONSF_NO_STOP_AT_DESTINATION_STATION = 2, ///< The vehicle will stop at any station it passes except the destination. rubidium@8855: ONSF_NO_STOP_AT_ANY_STATION = 3, ///< The vehicle will not stop at any stations it passes including the destination. rubidium@8869: ONSF_END rubidium@8771: }; rubidium@8771: rubidium@8853: /** rubidium@8853: * Reasons that could cause us to go to the depot. rubidium@8853: */ rubidium@8853: enum OrderDepotTypeFlags { rubidium@8853: ODTF_MANUAL = 0, ///< The player initiated this order manually. rubidium@8881: ODTFB_SERVICE = 1 << 0, ///< This depot order is because of the servicing limit. rubidium@8853: ODTFB_PART_OF_ORDERS = 1 << 1, ///< This depot order is because of a regular order. rubidium@8853: }; rubidium@8853: rubidium@8853: /** rubidium@8853: * Actions that can be performed when the vehicle enters the depot. rubidium@8853: */ rubidium@8853: enum OrderDepotActionFlags { rubidium@8853: ODATF_SERVICE_ONLY = 0, ///< Only service the vehicle. rubidium@8881: ODATFB_HALT = 1 << 0, ///< Service the vehicle and then halt it. rubidium@8894: ODATFB_NEAREST_DEPOT = 1 << 1, ///< Send the vehicle to the nearest depot. rubidium@8853: }; rubidium@8853: rubidium@8855: /** rubidium@8900: * Variables (of a vehicle) to 'cause' skipping on. rubidium@8900: */ rubidium@8900: enum OrderConditionVariable { rubidium@8900: OCV_LOAD_PERCENTAGE, ///< Skip based on the amount of load rubidium@8900: OCV_RELIABILITY, ///< Skip based on the reliability rubidium@8900: OCV_MAX_SPEED, ///< Skip based on the maximum speed rubidium@8900: OCV_AGE, ///< Skip based on the age rubidium@8900: OCV_REQUIRES_SERVICE, ///< Skip when the vehicle requires service rubidium@8903: OCV_UNCONDITIONALLY, ///< Always skip rubidium@8900: OCV_END rubidium@8900: }; rubidium@8900: rubidium@8900: /** rubidium@8900: * Comparator for the skip reasoning. rubidium@8900: */ rubidium@8900: enum OrderConditionComparator { rubidium@8900: OCC_EQUALS, ///< Skip if both values are equal rubidium@8900: OCC_NOT_EQUALS, ///< Skip if both values are not equal rubidium@8900: OCC_LESS_THAN, ///< Skip if the value is less than the limit rubidium@8900: OCC_LESS_EQUALS, ///< Skip if the value is less or equal to the limit rubidium@8900: OCC_MORE_THAN, ///< Skip if the value is more than the limit rubidium@8900: OCC_MORE_EQUALS, ///< Skip if the value is more or equal to the limit rubidium@8900: OCC_IS_TRUE, ///< Skip if the variable is true rubidium@8900: OCC_IS_FALSE, ///< Skip if the variable is false rubidium@8900: OCC_END rubidium@8900: }; rubidium@8900: rubidium@8900: rubidium@8900: /** rubidium@8869: * Enumeration for the data to set in CmdModifyOrder. rubidium@8771: */ rubidium@8869: enum ModifyOrderFlags { rubidium@8900: MOF_NON_STOP, ///< Passes a OrderNonStopFlags. rubidium@8900: MOF_UNLOAD, ///< Passes an OrderUnloadType. rubidium@8900: MOF_LOAD, ///< Passes an OrderLoadType rubidium@8900: MOF_DEPOT_ACTION, ///< Toggle the 'service' if needed flag. rubidium@8900: MOF_COND_VARIABLE, ///< A conditional variable changes. rubidium@8900: MOF_COND_COMPARATOR, ///< A comparator changes. rubidium@8900: MOF_COND_VALUE, ///< The value to set the condition to. rubidium@8900: MOF_END rubidium@8771: }; rubidium@8771: rubidium@8771: rubidium@8771: /* Possible clone options */ rubidium@8771: enum { rubidium@8771: CO_SHARE = 0, rubidium@8771: CO_COPY = 1, rubidium@8771: CO_UNSHARE = 2 rubidium@8771: }; rubidium@8771: rubidium@8771: struct Order; rubidium@8771: rubidium@8771: #endif /* ORDER_TYPE_H */