~lewiscawte/+junk/openttd-stable

« back to all changes in this revision

Viewing changes to src/vehicle_type.h

  • Committer: Lewis Cawte
  • Date: 2011-06-11 09:45:09 UTC
  • Revision ID: lewis@dev.lewiscawte.info-20110611094509-c5dqw2ot6pb9t10i
Adding stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: vehicle_type.h 22224 2011-03-07 19:18:38Z rubidium $ */
 
2
 
 
3
/*
 
4
 * This file is part of OpenTTD.
 
5
 * 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.
 
6
 * 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.
 
7
 * 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/>.
 
8
 */
 
9
 
 
10
/** @file vehicle_type.h Types related to vehicles. */
 
11
 
 
12
#ifndef VEHICLE_TYPE_H
 
13
#define VEHICLE_TYPE_H
 
14
 
 
15
#include "core/enum_type.hpp"
 
16
 
 
17
typedef uint32 VehicleID;
 
18
 
 
19
/** Available vehicle types. */
 
20
enum VehicleType {
 
21
        VEH_TRAIN,          ///< %Train vehicle type.
 
22
        VEH_ROAD,           ///< Road vehicle type.
 
23
        VEH_SHIP,           ///< %Ship vehicle type.
 
24
        VEH_AIRCRAFT,       ///< %Aircraft vehicle type.
 
25
        VEH_EFFECT,         ///< Effect vehicle type (smoke, explosions, sparks, bubbles)
 
26
        VEH_DISASTER,       ///< Disaster vehicle type.
 
27
        VEH_END,
 
28
        VEH_INVALID = 0xFF, ///< Non-existing type of vehicle.
 
29
};
 
30
DECLARE_POSTFIX_INCREMENT(VehicleType)
 
31
template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID, 3> {};
 
32
/** It needs to be 8bits, because we save and load it as such */
 
33
typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte;
 
34
 
 
35
struct Vehicle;
 
36
struct Train;
 
37
struct RoadVehicle;
 
38
struct Ship;
 
39
struct Aircraft;
 
40
struct EffectVehicle;
 
41
struct DisasterVehicle;
 
42
 
 
43
/** Base vehicle class. */
 
44
struct BaseVehicle
 
45
{
 
46
        VehicleTypeByte type;    ///< Type of vehicle
 
47
};
 
48
 
 
49
static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
 
50
 
 
51
/** Pathfinding option states */
 
52
enum VehiclePathFinders {
 
53
        VPF_OPF  = 0, ///< The Original PathFinder (only for ships)
 
54
        VPF_NPF  = 1, ///< New PathFinder
 
55
        VPF_YAPF = 2, ///< Yet Another PathFinder
 
56
};
 
57
 
 
58
/** Flags to add to p1 for goto depot commands. */
 
59
enum DepotCommand {
 
60
        DEPOT_SERVICE       = (1U << 28), ///< The vehicle will leave the depot right after arrival (serivce only)
 
61
        DEPOT_MASS_SEND     = (1U << 29), ///< Tells that it's a mass send to depot command (type in VLW flag)
 
62
        DEPOT_DONT_CANCEL   = (1U << 30), ///< Don't cancel current goto depot command if any
 
63
        DEPOT_LOCATE_HANGAR = (1U << 31), ///< Find another airport if the target one lacks a hangar
 
64
        DEPOT_COMMAND_MASK  = 0xFU << 28,
 
65
};
 
66
 
 
67
static const uint MAX_LENGTH_VEHICLE_NAME_CHARS  =  32; ///< The maximum length of a vehicle name in characters including '\0'
 
68
static const uint MAX_LENGTH_VEHICLE_NAME_PIXELS = 150; ///< The maximum length of a vehicle name in pixels
 
69
 
 
70
/** The length of a vehicle in tile units. */
 
71
static const uint VEHICLE_LENGTH = 8;
 
72
 
 
73
/** Vehicle acceleration models. */
 
74
enum AccelerationModel {
 
75
        AM_ORIGINAL,
 
76
        AM_REALISTIC,
 
77
};
 
78
 
 
79
#endif /* VEHICLE_TYPE_H */