order_type.h

Go to the documentation of this file.
00001 /* $Id: order_type.h 25735 2013-08-20 20:05:31Z fonsinchen $ */
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 
00034 static const uint IMPLICIT_ORDER_ONLY_CAP = 32;
00035 
00037 enum OrderType {
00038   OT_BEGIN         = 0,
00039   OT_NOTHING       = 0,
00040   OT_GOTO_STATION  = 1,
00041   OT_GOTO_DEPOT    = 2,
00042   OT_LOADING       = 3,
00043   OT_LEAVESTATION  = 4,
00044   OT_DUMMY         = 5,
00045   OT_GOTO_WAYPOINT = 6,
00046   OT_CONDITIONAL   = 7,
00047   OT_IMPLICIT     = 8,
00048   OT_END
00049 };
00050 
00052 typedef SimpleTinyEnumT<OrderType, byte> OrderTypeByte;
00053 
00054 
00058 enum OrderUnloadFlags {
00059   OUF_UNLOAD_IF_POSSIBLE = 0,      
00060   OUFB_UNLOAD            = 1 << 0, 
00061   OUFB_TRANSFER          = 1 << 1, 
00062   OUFB_NO_UNLOAD         = 1 << 2, 
00063 };
00064 
00068 enum OrderLoadFlags {
00069   OLF_LOAD_IF_POSSIBLE = 0,      
00070   OLFB_FULL_LOAD       = 1 << 1, 
00071   OLF_FULL_LOAD_ANY    = 3,      
00072   OLFB_NO_LOAD         = 4,      
00073 };
00074 
00078 enum OrderNonStopFlags {
00079   ONSF_STOP_EVERYWHERE                  = 0, 
00080   ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1, 
00081   ONSF_NO_STOP_AT_DESTINATION_STATION   = 2, 
00082   ONSF_NO_STOP_AT_ANY_STATION           = 3, 
00083   ONSF_END
00084 };
00085 
00089 enum OrderStopLocation {
00090   OSL_PLATFORM_NEAR_END = 0, 
00091   OSL_PLATFORM_MIDDLE   = 1, 
00092   OSL_PLATFORM_FAR_END  = 2, 
00093   OSL_END
00094 };
00095 
00099 enum OrderDepotTypeFlags {
00100   ODTF_MANUAL          = 0,      
00101   ODTFB_SERVICE        = 1 << 0, 
00102   ODTFB_PART_OF_ORDERS = 1 << 1, 
00103 };
00104 
00108 enum OrderDepotActionFlags {
00109   ODATF_SERVICE_ONLY   = 0,      
00110   ODATFB_HALT          = 1 << 0, 
00111   ODATFB_NEAREST_DEPOT = 1 << 1, 
00112 };
00113 DECLARE_ENUM_AS_BIT_SET(OrderDepotActionFlags)
00114 
00115 
00118 enum OrderConditionVariable {
00119   OCV_LOAD_PERCENTAGE,    
00120   OCV_RELIABILITY,        
00121   OCV_MAX_SPEED,          
00122   OCV_AGE,                
00123   OCV_REQUIRES_SERVICE,   
00124   OCV_UNCONDITIONALLY,    
00125   OCV_REMAINING_LIFETIME, 
00126   OCV_END
00127 };
00128 
00132 enum OrderConditionComparator {
00133   OCC_EQUALS,      
00134   OCC_NOT_EQUALS,  
00135   OCC_LESS_THAN,   
00136   OCC_LESS_EQUALS, 
00137   OCC_MORE_THAN,   
00138   OCC_MORE_EQUALS, 
00139   OCC_IS_TRUE,     
00140   OCC_IS_FALSE,    
00141   OCC_END
00142 };
00143 
00144 
00148 enum ModifyOrderFlags {
00149   MOF_NON_STOP,        
00150   MOF_STOP_LOCATION,   
00151   MOF_UNLOAD,          
00152   MOF_LOAD,            
00153   MOF_DEPOT_ACTION,    
00154   MOF_COND_VARIABLE,   
00155   MOF_COND_COMPARATOR, 
00156   MOF_COND_VALUE,      
00157   MOF_COND_DESTINATION,
00158   MOF_END
00159 };
00160 template <> struct EnumPropsT<ModifyOrderFlags> : MakeEnumPropsT<ModifyOrderFlags, byte, MOF_NON_STOP, MOF_END, MOF_END, 4> {};
00161 
00165 enum OrderDepotAction {
00166   DA_ALWAYS_GO, 
00167   DA_SERVICE,   
00168   DA_STOP,      
00169   DA_END
00170 };
00171 
00175 enum ModifyTimetableFlags {
00176   MTF_WAIT_TIME,    
00177   MTF_TRAVEL_TIME,  
00178   MTF_TRAVEL_SPEED, 
00179   MTF_END
00180 };
00181 template <> struct EnumPropsT<ModifyTimetableFlags> : MakeEnumPropsT<ModifyTimetableFlags, byte, MTF_WAIT_TIME, MTF_END, MTF_END, 2> {};
00182 
00183 
00185 enum CloneOptions {
00186   CO_SHARE   = 0,
00187   CO_COPY    = 1,
00188   CO_UNSHARE = 2
00189 };
00190 
00191 struct Order;
00192 struct OrderList;
00193 
00194 #endif /* ORDER_TYPE_H */