# vehicle_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 VEHICLE_TYPE_H
    00013 #define VEHICLE_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00018 typedef uint32 VehicleID;
    00019
    00021 enum VehicleType {
    00022   VEH_TRAIN,
    00023   VEH_ROAD,
    00024   VEH_SHIP,
    00025   VEH_AIRCRAFT,
    00026   VEH_EFFECT,
    00027   VEH_DISASTER,
    00028   VEH_END,
    00029   VEH_INVALID = 0xFF,
    00030 };
    00031 DECLARE_POSTFIX_INCREMENT(VehicleType)
    00033 template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID, 3> {};
    00035 typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte;
    00036
    00037 struct Vehicle;
    00038 struct Train;
    00039 struct RoadVehicle;
    00040 struct Ship;
    00041 struct Aircraft;
    00042 struct EffectVehicle;
    00043 struct DisasterVehicle;
    00044
    00046 struct BaseVehicle
    00047 {
    00048   VehicleTypeByte type;
    00049 };
    00050
    00051 static const VehicleID INVALID_VEHICLE = 0xFFFFF;
    00052
    00054 enum VehiclePathFinders {
    00055   VPF_OPF  = 0,
    00056   VPF_NPF  = 1,
    00057   VPF_YAPF = 2,
    00058 };
    00059
    00061 enum DepotCommand {
    00062   DEPOT_SERVICE       = (1U << 28),
    00063   DEPOT_MASS_SEND     = (1U << 29),
    00064   DEPOT_DONT_CANCEL   = (1U << 30),
    00065   DEPOT_LOCATE_HANGAR = (1U << 31),
    00066   DEPOT_COMMAND_MASK  = 0xFU << 28,
    00067 };
    00068
    00069 static const uint MAX_LENGTH_VEHICLE_NAME_CHARS  =  32;
    00070
    00071 /* The different types of breakdowns. */
    00072 enum BreakdownType {
    00073   BREAKDOWN_CRITICAL  = 0,
    00074   BREAKDOWN_EM_STOP   = 1,
    00075   BREAKDOWN_LOW_SPEED = 2,
    00076   BREAKDOWN_LOW_POWER = 3,
    00077   /* Aircraft have totally different breakdowns, so we use aliases to make things clearer. */
    00078   BREAKDOWN_AIRCRAFT_SPEED      = BREAKDOWN_CRITICAL,
    00079   BREAKDOWN_AIRCRAFT_DEPOT      = BREAKDOWN_EM_STOP,
    00080   BREAKDOWN_AIRCRAFT_EM_LANDING = BREAKDOWN_LOW_SPEED,
    00081 };
    00082
    00084 static const uint VEHICLE_LENGTH = 8;
    00085
    00087 enum AccelerationModel {
    00088   AM_ORIGINAL,
    00089   AM_REALISTIC,
    00090 };
    00091
    00092 #endif /* VEHICLE_TYPE_H */