OpenTTD
engine_type.h
Go to the documentation of this file.
1 /* $Id: engine_type.h 24810 2012-12-09 16:55:03Z frosch $ */
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 
12 #ifndef ENGINE_TYPE_H
13 #define ENGINE_TYPE_H
14 
15 #include "economy_type.h"
16 #include "rail_type.h"
17 #include "cargo_type.h"
18 #include "date_type.h"
19 #include "sound_type.h"
20 #include "strings_type.h"
21 
22 typedef uint16 EngineID;
23 
24 struct Engine;
25 
31 };
32 
40 };
41 
44  byte image_index;
45  RailVehicleTypes railveh_type;
46  byte cost_factor;
47  RailTypeByte railtype;
48  uint16 max_speed;
49  uint16 power;
50  uint16 weight;
51  byte running_cost;
52  Price running_cost_class;
54  byte capacity;
56  uint16 pow_wag_power;
61  byte air_drag;
63 };
64 
67  byte image_index;
68  byte cost_factor;
69  uint16 max_speed;
70  uint16 capacity;
71  byte running_cost;
72  SoundID sfx;
77 
79  uint ApplyWaterClassSpeedFrac(uint raw_speed, bool is_ocean) const
80  {
81  /* speed_frac == 0 means no reduction while 0xFF means reduction to 1/256. */
82  return raw_speed * (256 - (is_ocean ? this->ocean_speed_frac : this->canal_speed_frac)) / 256;
83  }
84 };
85 
92  AIR_HELI = 0,
93  AIR_CTOL = 1,
94  AIR_FAST = 2
95 };
96 
99  byte image_index;
100  byte cost_factor;
101  byte running_cost;
102  byte subtype;
103  SoundID sfx;
104  byte acceleration;
105  uint16 max_speed;
108  uint16 max_range;
109 };
110 
113  byte image_index;
114  byte cost_factor;
115  byte running_cost;
116  Price running_cost_class;
117  SoundID sfx;
118  uint16 max_speed;
119  byte capacity;
120  uint8 weight;
121  uint8 power;
123  uint8 air_drag;
126 };
127 
132 struct EngineInfo {
136  byte decay_speed;
137  byte load_amount;
138  byte climates;
139  CargoID cargo_type;
140  uint32 refit_mask;
141  byte refit_cost;
142  byte misc_flags;
147 };
148 
161 };
162 
169 };
170 
171 static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32;
172 
173 static const EngineID INVALID_ENGINE = 0xFFFF;
174 
175 #endif /* ENGINE_TYPE_H */