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