~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/engine_type.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: engine_type.h 15321 2009-02-02 21:52:34Z peter1138 $ */
 
2
 
 
3
/** @file engine_type.h Types related to engines. */
 
4
 
 
5
#ifndef ENGINE_TYPE_H
 
6
#define ENGINE_TYPE_H
 
7
 
 
8
#include "rail_type.h"
 
9
#include "cargo_type.h"
 
10
#include "vehicle_type.h"
 
11
#include "gfx_type.h"
 
12
#include "date_type.h"
 
13
#include "sound_type.h"
 
14
#include "company_type.h"
 
15
#include "strings_type.h"
 
16
 
 
17
typedef uint16 EngineID;
 
18
 
 
19
struct Engine;
 
20
 
 
21
enum RailVehicleTypes {
 
22
        RAILVEH_SINGLEHEAD,  ///< indicates a "standalone" locomotive
 
23
        RAILVEH_MULTIHEAD,   ///< indicates a combination of two locomotives
 
24
        RAILVEH_WAGON,       ///< simple wagon, not motorized
 
25
};
 
26
 
 
27
enum EngineClass {
 
28
        EC_STEAM,
 
29
        EC_DIESEL,
 
30
        EC_ELECTRIC,
 
31
        EC_MONORAIL,
 
32
        EC_MAGLEV,
 
33
};
 
34
 
 
35
struct RailVehicleInfo {
 
36
        byte image_index;
 
37
        RailVehicleTypes railveh_type;
 
38
        byte cost_factor;               ///< Purchase cost factor;      For multiheaded engines the sum of both engine prices.
 
39
        RailTypeByte railtype;
 
40
        uint16 max_speed;
 
41
        uint16 power;                   ///< Power of engine;           For multiheaded engines the sum of both engine powers.
 
42
        uint16 weight;                  ///< Weight of vehicle;         For multiheaded engines the weight of each single engine.
 
43
        byte running_cost;              ///< Running cost of engine;    For multiheaded engines the sum of both running costs.
 
44
        byte running_cost_class;
 
45
        EngineClass engclass;           ///< Class of engine for this vehicle
 
46
        byte capacity;                  ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine.
 
47
        CargoID cargo_type;
 
48
        byte ai_rank;
 
49
        byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only
 
50
        uint16 pow_wag_power;
 
51
        byte pow_wag_weight;
 
52
        byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value
 
53
                            //       for when the 'powered wagon' callback fails. But it should really also determine what
 
54
                            //       kind of visual effect to generate for a vehicle (default, steam, diesel, electric).
 
55
                            //       Same goes for the callback result, which atm is only used to check if a wagon is powered.
 
56
        byte shorten_factor;   ///< length on main map for this type is 8 - shorten_factor
 
57
        byte tractive_effort;  ///< Tractive effort coefficient
 
58
        byte user_def_data;    ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
 
59
};
 
60
 
 
61
struct ShipVehicleInfo {
 
62
        byte image_index;
 
63
        byte cost_factor;
 
64
        uint16 max_speed;
 
65
        CargoID cargo_type;
 
66
        uint16 capacity;
 
67
        byte running_cost;
 
68
        SoundFxByte sfx;
 
69
        bool refittable;
 
70
};
 
71
 
 
72
/* AircraftVehicleInfo subtypes, bitmask type.
 
73
 * If bit 0 is 0 then it is a helicopter, otherwise it is a plane
 
74
 * in which case bit 1 tells us whether it's a big(fast) plane or not */
 
75
enum {
 
76
        AIR_HELI = 0,
 
77
        AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes
 
78
        AIR_FAST = 2
 
79
};
 
80
 
 
81
struct AircraftVehicleInfo {
 
82
        byte image_index;
 
83
        byte cost_factor;
 
84
        byte running_cost;
 
85
        byte subtype;
 
86
        SoundFxByte sfx;
 
87
        byte acceleration;
 
88
        uint16 max_speed;
 
89
        byte mail_capacity;
 
90
        uint16 passenger_capacity;
 
91
};
 
92
 
 
93
struct RoadVehicleInfo {
 
94
        byte image_index;
 
95
        byte cost_factor;
 
96
        byte running_cost;
 
97
        byte running_cost_class;
 
98
        SoundFxByte sfx;
 
99
        uint16 max_speed;        ///< Maximum speed in mph/3.2 units
 
100
        byte capacity;
 
101
        CargoID cargo_type;
 
102
        uint8 weight;            ///< Weight in 1/4t units
 
103
        uint8 power;             ///< Power in 10hp units
 
104
        uint8 tractive_effort;   ///< Coefficient of tractive effort
 
105
        uint8 air_drag;          ///< Coefficient of air drag
 
106
};
 
107
 
 
108
/** Information about a vehicle
 
109
 *  @see table/engines.h
 
110
 */
 
111
struct EngineInfo {
 
112
        Date base_intro;
 
113
        Year lifelength;
 
114
        Year base_life;
 
115
        byte decay_speed;
 
116
        byte load_amount;
 
117
        byte climates;
 
118
        uint32 refit_mask;
 
119
        byte refit_cost;
 
120
        byte misc_flags;
 
121
        byte callbackmask;
 
122
        int8 retire_early;  ///< Number of years early to retire vehicle
 
123
        StringID string_id; ///< Default name of engine
 
124
};
 
125
 
 
126
/**
 
127
 * EngineInfo.misc_flags is a bitmask, with the following values
 
128
 */
 
129
enum {
 
130
        EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves
 
131
        EF_ROAD_TRAM  = 0, ///< Road vehicle is a tram/light rail vehicle
 
132
        EF_USES_2CC   = 1, ///< Vehicle uses two company colours
 
133
        EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU)
 
134
};
 
135
 
 
136
/**
 
137
 * Engine.flags is a bitmask, with the following values.
 
138
 */
 
139
enum {
 
140
        ENGINE_AVAILABLE         = 1, ///< This vehicle is available to everyone.
 
141
        ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a company.
 
142
        ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a company.
 
143
};
 
144
 
 
145
enum {
 
146
        NUM_VEHICLE_TYPES             =   6,
 
147
        MAX_LENGTH_ENGINE_NAME_BYTES  =  31, ///< The maximum length of an engine name in bytes including '\0'
 
148
        MAX_LENGTH_ENGINE_NAME_PIXELS = 160, ///< The maximum length of an engine name in pixels
 
149
};
 
150
 
 
151
static const EngineID INVALID_ENGINE = 0xFFFF;
 
152
 
 
153
#endif /* ENGINE_TYPE_H */