# order_type.h

Go to the documentation of this file.

    00001 /* $Id: order_type.h 18518 2009-12-16 21:31:21Z yexo $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef ORDER_TYPE_H
    00013 #define ORDER_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00017 typedef byte VehicleOrderID;
    00018 typedef uint16 OrderID;
    00019 typedef uint16 OrderListID;
    00020 typedef uint16 DestinationID;
    00021
    00023 static const VehicleOrderID INVALID_VEH_ORDER_ID = 0xFF;
    00025 static const VehicleOrderID MAX_VEH_ORDER_ID     = INVALID_VEH_ORDER_ID - 1;
    00026
    00028 static const OrderID INVALID_ORDER = 0xFFFF;
    00029
    00030 /* Order types */
    00031 enum OrderType {
    00032   OT_BEGIN         = 0,
    00033   OT_NOTHING       = 0,
    00034   OT_GOTO_STATION  = 1,
    00035   OT_GOTO_DEPOT    = 2,
    00036   OT_LOADING       = 3,
    00037   OT_LEAVESTATION  = 4,
    00038   OT_DUMMY         = 5,
    00039   OT_GOTO_WAYPOINT = 6,
    00040   OT_CONDITIONAL   = 7,
    00041   OT_END
    00042 };
    00043
    00045 typedef SimpleTinyEnumT<OrderType, byte> OrderTypeByte;
    00046
    00047
    00051 enum OrderUnloadFlags {
    00052   OUF_UNLOAD_IF_POSSIBLE = 0,
    00053   OUFB_UNLOAD            = 1 << 0,
    00054   OUFB_TRANSFER          = 1 << 1,
    00055   OUFB_NO_UNLOAD         = 1 << 2,
    00056 };
    00057
    00061 enum OrderLoadFlags {
    00062   OLF_LOAD_IF_POSSIBLE = 0,
    00063   OLFB_FULL_LOAD       = 1 << 1,
    00064   OLF_FULL_LOAD_ANY    = 3,
    00065   OLFB_NO_LOAD         = 4,
    00066 };
    00067
    00071 enum OrderNonStopFlags {
    00072   ONSF_STOP_EVERYWHERE                  = 0,
    00073   ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1,
    00074   ONSF_NO_STOP_AT_DESTINATION_STATION   = 2,
    00075   ONSF_NO_STOP_AT_ANY_STATION           = 3,
    00076   ONSF_END
    00077 };
    00078
    00082 enum OrderStopLocation {
    00083   OSL_PLATFORM_NEAR_END = 0,
    00084   OSL_PLATFORM_MIDDLE   = 1,
    00085   OSL_PLATFORM_FAR_END  = 2,
    00086   OSL_END
    00087 };
    00088
    00092 enum OrderDepotTypeFlags {
    00093   ODTF_MANUAL          = 0,
    00094   ODTFB_SERVICE        = 1 << 0,
    00095   ODTFB_PART_OF_ORDERS = 1 << 1,
    00096 };
    00097
    00101 enum OrderDepotActionFlags {
    00102   ODATF_SERVICE_ONLY   = 0,
    00103   ODATFB_HALT          = 1 << 0,
    00104   ODATFB_NEAREST_DEPOT = 1 << 1,
    00105 };
    00106 DECLARE_ENUM_AS_BIT_SET(OrderDepotActionFlags);
    00107
    00111 enum OrderConditionVariable {
    00112   OCV_LOAD_PERCENTAGE,
    00113   OCV_RELIABILITY,
    00114   OCV_MAX_SPEED,
    00115   OCV_AGE,
    00116   OCV_REQUIRES_SERVICE,
    00117   OCV_UNCONDITIONALLY,
    00118   OCV_END
    00119 };
    00120
    00124 enum OrderConditionComparator {
    00125   OCC_EQUALS,
    00126   OCC_NOT_EQUALS,
    00127   OCC_LESS_THAN,
    00128   OCC_LESS_EQUALS,
    00129   OCC_MORE_THAN,
    00130   OCC_MORE_EQUALS,
    00131   OCC_IS_TRUE,
    00132   OCC_IS_FALSE,
    00133   OCC_END
    00134 };
    00135
    00136
    00140 enum ModifyOrderFlags {
    00141   MOF_NON_STOP,
    00142   MOF_STOP_LOCATION,
    00143   MOF_UNLOAD,
    00144   MOF_LOAD,
    00145   MOF_DEPOT_ACTION,
    00146   MOF_COND_VARIABLE,
    00147   MOF_COND_COMPARATOR,
    00148   MOF_COND_VALUE,
    00149   MOF_COND_DESTINATION,
    00150   MOF_END
    00151 };
    00152
    00156 enum OrderDepotAction {
    00157   DA_ALWAYS_GO,
    00158   DA_SERVICE,
    00159   DA_STOP,
    00160   DA_END
    00161 };
    00162
    00163
    00164 /* Possible clone options */
    00165 enum {
    00166   CO_SHARE   = 0,
    00167   CO_COPY    = 1,
    00168   CO_UNSHARE = 2
    00169 };
    00170
    00171 struct Order;
    00172 struct OrderList;
    00173
    00174 #endif /* ORDER_TYPE_H */