# order_type.h

Go to the documentation of this file.

    00001 /* $Id$ */
    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
    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_IMPLICIT     = 8,
    00042   OT_END
    00043 };
    00044
    00046 typedef SimpleTinyEnumT<OrderType, byte> OrderTypeByte;
    00047
    00048
    00052 enum OrderUnloadFlags {
    00053   OUF_UNLOAD_IF_POSSIBLE = 0,
    00054   OUFB_UNLOAD            = 1 << 0,
    00055   OUFB_TRANSFER          = 1 << 1,
    00056   OUFB_NO_UNLOAD         = 1 << 2,
    00057 };
    00058
    00062 enum OrderLoadFlags {
    00063   OLF_LOAD_IF_POSSIBLE = 0,
    00064   OLFB_FULL_LOAD       = 1 << 1,
    00065   OLF_FULL_LOAD_ANY    = 3,
    00066   OLFB_NO_LOAD         = 4,
    00067 };
    00068
    00072 enum OrderNonStopFlags {
    00073   ONSF_STOP_EVERYWHERE                  = 0,
    00074   ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1,
    00075   ONSF_NO_STOP_AT_DESTINATION_STATION   = 2,
    00076   ONSF_NO_STOP_AT_ANY_STATION           = 3,
    00077   ONSF_END
    00078 };
    00079
    00083 enum OrderStopLocation {
    00084   OSL_PLATFORM_NEAR_END = 0,
    00085   OSL_PLATFORM_MIDDLE   = 1,
    00086   OSL_PLATFORM_FAR_END  = 2,
    00087   OSL_END
    00088 };
    00089
    00093 enum OrderDepotTypeFlags {
    00094   ODTF_MANUAL          = 0,
    00095   ODTFB_SERVICE        = 1 << 0,
    00096   ODTFB_PART_OF_ORDERS = 1 << 1,
    00097 };
    00098
    00102 enum OrderDepotActionFlags {
    00103   ODATF_SERVICE_ONLY   = 0,
    00104   ODATFB_HALT          = 1 << 0,
    00105   ODATFB_NEAREST_DEPOT = 1 << 1,
    00106 };
    00107 DECLARE_ENUM_AS_BIT_SET(OrderDepotActionFlags)
    00108
    00109
    00112 enum OrderConditionVariable {
    00113   OCV_LOAD_PERCENTAGE,
    00114   OCV_RELIABILITY,
    00115   OCV_MAX_SPEED,
    00116   OCV_AGE,
    00117   OCV_REQUIRES_SERVICE,
    00118   OCV_UNCONDITIONALLY,
    00119   OCV_REMAINING_LIFETIME,
    00120   OCV_END
    00121 };
    00122
    00126 enum OrderConditionComparator {
    00127   OCC_EQUALS,
    00128   OCC_NOT_EQUALS,
    00129   OCC_LESS_THAN,
    00130   OCC_LESS_EQUALS,
    00131   OCC_MORE_THAN,
    00132   OCC_MORE_EQUALS,
    00133   OCC_IS_TRUE,
    00134   OCC_IS_FALSE,
    00135   OCC_END
    00136 };
    00137
    00138
    00142 enum ModifyOrderFlags {
    00143   MOF_NON_STOP,
    00144   MOF_STOP_LOCATION,
    00145   MOF_UNLOAD,
    00146   MOF_LOAD,
    00147   MOF_DEPOT_ACTION,
    00148   MOF_COND_VARIABLE,
    00149   MOF_COND_COMPARATOR,
    00150   MOF_COND_VALUE,
    00151   MOF_COND_DESTINATION,
    00152   MOF_END
    00153 };
    00154 template <> struct EnumPropsT<ModifyOrderFlags> : MakeEnumPropsT<ModifyOrderFlags, byte, MOF_NON_STOP, MOF_END, MOF_END, 4> {};
    00155
    00159 enum OrderDepotAction {
    00160   DA_ALWAYS_GO,
    00161   DA_SERVICE,
    00162   DA_STOP,
    00163   DA_END
    00164 };
    00165
    00169 enum ModifyTimetableFlags {
    00170   MTF_WAIT_TIME,
    00171   MTF_TRAVEL_TIME,
    00172   MTF_TRAVEL_SPEED,
    00173   MTF_END
    00174 };
    00175 template <> struct EnumPropsT<ModifyTimetableFlags> : MakeEnumPropsT<ModifyTimetableFlags, byte, MTF_WAIT_TIME, MTF_END, MTF_END, 2> {};
    00176
    00177
    00178 /* Possible clone options */
    00179 enum CloneOptions {
    00180   CO_SHARE   = 0,
    00181   CO_COPY    = 1,
    00182   CO_UNSHARE = 2
    00183 };
    00184
    00185 struct Order;
    00186 struct OrderList;
    00187
    00188 #endif /* ORDER_TYPE_H */