OpenTTD

rail.cpp
Go to the documentation of this file.
1 /* $Id: rail.cpp 27808 2017-03-19 22:30:47Z peter1138 $ */
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 #include "stdafx.h"
13 #include "station_map.h"
14 #include "tunnelbridge_map.h"
15 #include "date_func.h"
16 #include "company_func.h"
17 #include "company_base.h"
18 #include "engine_base.h"
19
20 #include "safeguards.h"
21
22 /* XXX: Below 3 tables store duplicate data. Maybe remove some? */
23 /* Maps a trackdir to the bit that stores its status in the map arrays, in the
24 * direction along with the trackdir */
25 extern const byte _signal_along_trackdir[TRACKDIR_END] = {
26 0x8, 0x8, 0x8, 0x2, 0x4, 0x1, 0, 0,
27 0x4, 0x4, 0x4, 0x1, 0x8, 0x2
28 };
29
30 /* Maps a trackdir to the bit that stores its status in the map arrays, in the
31 * direction against the trackdir */
32 extern const byte _signal_against_trackdir[TRACKDIR_END] = {
33 0x4, 0x4, 0x4, 0x1, 0x8, 0x2, 0, 0,
34 0x8, 0x8, 0x8, 0x2, 0x4, 0x1
35 };
36
37 /* Maps a Track to the bits that store the status of the two signals that can
38 * be present on the given track */
39 extern const byte _signal_on_track[] = {
40 0xC, 0xC, 0xC, 0x3, 0xC, 0x3
41 };
42
43 /* Maps a diagonal direction to the all trackdirs that are connected to any
44 * track entering in this direction (including those making 90 degree turns)
45 */
46 extern const TrackdirBits _exitdir_reaches_trackdirs[] = {
47 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_LOWER_E | TRACKDIR_BIT_LEFT_N, // DIAGDIR_NE
48 TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_UPPER_E, // DIAGDIR_SE
49 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_RIGHT_S, // DIAGDIR_SW
50 TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_W // DIAGDIR_NW
51 };
52
53 extern const Trackdir _next_trackdir[TRACKDIR_END] = {
54 TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_LOWER_E, TRACKDIR_UPPER_E, TRACKDIR_RIGHT_S, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR,
55 TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_LOWER_W, TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N
56 };
57
58 /* Maps a trackdir to all trackdirs that make 90 deg turns with it. */
59 extern const TrackdirBits _track_crosses_trackdirs[TRACK_END] = {
60 TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_Y_NW, // TRACK_X
61 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_X_SW, // TRACK_Y
62 TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, // TRACK_UPPER
63 TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, // TRACK_LOWER
64 TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_LOWER_E, // TRACK_LEFT
65 TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_LOWER_E // TRACK_RIGHT
66 };
67
68 /* Maps a track to all tracks that make 90 deg turns with it. */
69 extern const TrackBits _track_crosses_tracks[] = {
70 TRACK_BIT_Y, // TRACK_X
71 TRACK_BIT_X, // TRACK_Y
72 TRACK_BIT_VERT, // TRACK_UPPER
73 TRACK_BIT_VERT, // TRACK_LOWER
74 TRACK_BIT_HORZ, // TRACK_LEFT
75 TRACK_BIT_HORZ // TRACK_RIGHT
76 };
77
78 /* Maps a trackdir to the (4-way) direction the tile is exited when following
79 * that trackdir */
80 extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END] = {
81 DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_NE,
82 DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE,
83 };
84
85 extern const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
86 {TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR},
87 {INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW},
88 {TRACKDIR_UPPER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_W},
89 {INVALID_TRACKDIR, TRACKDIR_LOWER_E, TRACKDIR_LOWER_W, INVALID_TRACKDIR},
90 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LEFT_S, TRACKDIR_LEFT_N},
91 {TRACKDIR_RIGHT_N, TRACKDIR_RIGHT_S, INVALID_TRACKDIR, INVALID_TRACKDIR}
92 };
93
94 extern const Trackdir _track_enterdir_to_trackdir[][DIAGDIR_END] = {
95 {TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR},
96 {INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW},
97 {INVALID_TRACKDIR, TRACKDIR_UPPER_E, TRACKDIR_UPPER_W, INVALID_TRACKDIR},
98 {TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W},
99 {TRACKDIR_LEFT_N, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR},
100 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, TRACKDIR_RIGHT_N}
101 };
102
103 extern const Trackdir _track_direction_to_trackdir[][DIR_END] = {
104 {INVALID_TRACKDIR, TRACKDIR_X_NE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR, INVALID_TRACKDIR},
105 {INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_Y_NW},
106 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_W, INVALID_TRACKDIR},
107 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W, INVALID_TRACKDIR},
108 {TRACKDIR_LEFT_N, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR},
109 {TRACKDIR_RIGHT_N, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR}
110 };
111
112 extern const Trackdir _dir_to_diag_trackdir[] = {
113 TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_X_SW, TRACKDIR_Y_NW,
114 };
115
116 extern const TrackBits _corner_to_trackbits[] = {
117 TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_RIGHT, TRACK_BIT_UPPER,
118 };
119
120 extern const TrackdirBits _uphill_trackdirs[] = {
121 TRACKDIR_BIT_NONE ,
122 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW,
123 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE,
124 TRACKDIR_BIT_X_SW ,
125 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE,
126 TRACKDIR_BIT_NONE ,
127 TRACKDIR_BIT_Y_SE ,
128 TRACKDIR_BIT_NONE ,
129 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW,
130 TRACKDIR_BIT_Y_NW ,
131 TRACKDIR_BIT_NONE ,
132 TRACKDIR_BIT_NONE ,
133 TRACKDIR_BIT_X_NE ,
134 TRACKDIR_BIT_NONE ,
135 TRACKDIR_BIT_NONE ,
136 TRACKDIR_BIT_NONE ,
137 TRACKDIR_BIT_NONE ,
138 TRACKDIR_BIT_NONE ,
139 TRACKDIR_BIT_NONE ,
140 TRACKDIR_BIT_NONE ,
141 TRACKDIR_BIT_NONE ,
142 TRACKDIR_BIT_NONE ,
143 TRACKDIR_BIT_NONE ,
144 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE,
145 TRACKDIR_BIT_NONE ,
146 TRACKDIR_BIT_NONE ,
147 TRACKDIR_BIT_NONE ,
148 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW,
149 TRACKDIR_BIT_NONE ,
150 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW,
151 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE,
152 };
153
157 RailType GetTileRailType(TileIndex tile)
158 {
159 switch (GetTileType(tile)) {
160 case MP_RAILWAY:
161 return GetRailType(tile);
162
163 case MP_ROAD:
164 /* rail/road crossing */
165 if (IsLevelCrossing(tile)) return GetRailType(tile);
166 break;
167
168 case MP_STATION:
169 if (HasStationRail(tile)) return GetRailType(tile);
170 break;
171
172 case MP_TUNNELBRIDGE:
173 if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
174 break;
175
176 default:
177 break;
178 }
179 return INVALID_RAILTYPE;
180 }
181
188 bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
189 {
190 return HasBit(Company::Get(company)->avail_railtypes, railtype);
191 }
192
198 bool ValParamRailtype(const RailType rail)
199 {
200 return rail < RAILTYPE_END && HasRailtypeAvail(_current_company, rail);
201 }
202
210 RailType GetBestRailtype(const CompanyID company)
211 {
212 if (HasRailtypeAvail(company, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV;
213 if (HasRailtypeAvail(company, RAILTYPE_MONO)) return RAILTYPE_MONO;
214 if (HasRailtypeAvail(company, RAILTYPE_ELECTRIC)) return RAILTYPE_ELECTRIC;
215 return RAILTYPE_RAIL;
216 }
217
225 RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date)
226 {
227 RailTypes rts = current;
228
229 for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
230 const RailtypeInfo *rti = GetRailTypeInfo(rt);
231 /* Unused rail type. */
232 if (rti->label == 0) continue;
233
234 /* Not date introduced. */
235 if (!IsInsideMM(rti->introduction_date, 0, MAX_DAY)) continue;
236
237 /* Not yet introduced at this date. */
238 if (rti->introduction_date > date) continue;
239
240 /* Have we introduced all required railtypes? */
241 RailTypes required = rti->introduction_required_railtypes;
242 if ((rts & required) != required) continue;
243
244 rts |= rti->introduces_railtypes;
245 }
246
247 /* When we added railtypes we need to run this method again; the added
248 * railtypes might enable more rail types to become introduced. */
249 return rts == current ? rts : AddDateIntroducedRailTypes(rts, date);
250 }
251
257 RailTypes GetCompanyRailtypes(CompanyID company)
258 {
259 RailTypes rts = RAILTYPES_NONE;
260
261 Engine *e;
262 FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
263 const EngineInfo *ei = &e->info;
264
265 if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
266 (HasBit(e->company_avail, company) || _date >= e->intro_date + DAYS_IN_YEAR)) {
267 const RailVehicleInfo *rvi = &e->u.rail;
268
269 if (rvi->railveh_type != RAILVEH_WAGON) {
270 assert(rvi->railtype < RAILTYPE_END);
271 rts |= GetRailTypeInfo(rvi->railtype)->introduces_railtypes;
272 }
273 }
274 }
275
276 return AddDateIntroducedRailTypes(rts, _date);
277 }
278
285 RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
286 {
287 /* Loop through each rail type until the label is found */
288 for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
289 const RailtypeInfo *rti = GetRailTypeInfo(r);
290 if (rti->label == label) return r;
291 }
292
293 if (allow_alternate_labels) {
294 /* Test if any rail type defines the label as an alternate. */
295 for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
296 const RailtypeInfo *rti = GetRailTypeInfo(r);
297 if (rti->alternate_labels.Contains(label)) return r;
298 }
299 }
300
301 /* No matching label was found, so it is invalid */
302 return INVALID_RAILTYPE;
303 }
RAILTYPE_END
Used for iterations.
Definition: rail_type.h:35
GetTileType
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Definition: tile_map.h:89
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:77
company_base.h
Definition of stuff that is very close to a company, like the company struct itself.
GetRailTypeInfo
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Definition: rail.h:296
DAYS_IN_YEAR
static const int DAYS_IN_YEAR
days per year
Definition: date_type.h:31
GetTunnelBridgeTransportType
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
Definition: tunnelbridge_map.h:41
RailTypes
RailTypes
The different roadtypes we support, but then a bitmask of them.
Definition: rail_type.h:52
RAILTYPE_MONO
Monorail.
Definition: rail_type.h:33
GameCreationSettings::landscape
byte landscape
the landscape we&#39;re currently in
Definition: settings_type.h:288
station_map.h
Maps accessors for stations.
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:29
TRACKDIR_Y_NW
Y-axis and direction to north-west.
Definition: track_type.h:85
Pool::PoolItem<&_company_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:246
date_func.h
Functions related to dates.
IsInsideMM
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
Definition: math_func.hpp:266
RAILTYPE_MAGLEV
Maglev.
Definition: rail_type.h:34
TRACKDIR_END
Used for iterations.
Definition: track_type.h:92
RailtypeInfo::introduction_required_railtypes
RailTypes introduction_required_railtypes
Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_dat...
Definition: rail.h:250
MP_ROAD
A tile with road (or tram tracks)
Definition: tile_type.h:45
Engine::intro_date
Date intro_date
Date of introduction of the engine.
Definition: engine_base.h:25
TRACKDIR_RIGHT_N
Right track and direction to north.
Definition: track_type.h:89
TRACKDIR_BIT_RIGHT_S
Track right, direction south.
Definition: track_type.h:113
ValParamRailtype
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
Definition: rail.cpp:198
TRACKDIR_X_SW
X-axis and direction to south-west.
Definition: track_type.h:84
RailtypeInfo::alternate_labels
RailTypeLabelList alternate_labels
Rail type labels this type provides in addition to the main label.
Definition: rail.h:230
DIAGDIR_NE
Northeast, upper right on your monitor.
Definition: direction_type.h:82
MP_RAILWAY
A railway.
Definition: tile_type.h:44
RAILTYPE_RAIL
Standard non-electric rails.
Definition: rail_type.h:31
IsLevelCrossing
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
Definition: road_map.h:68
RailtypeInfo
This struct contains all the info that is needed to draw and construct tracks.
Definition: rail.h:116
TRACK_END
Used for iterations.
Definition: track_type.h:29
TRACKDIR_BIT_UPPER_E
Track upper, direction east.
Definition: track_type.h:110
GetBestRailtype
RailType GetBestRailtype(const CompanyID company)
Returns the "best" railtype a company can build.
Definition: rail.cpp:210
HasStationRail
static bool HasStationRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint...
Definition: station_map.h:136
TRACK_BIT_RIGHT
Right track.
Definition: track_type.h:48
TRACKDIR_BIT_RIGHT_N
Track right, direction north.
Definition: track_type.h:120
TrackBits
TrackBits
Bitfield corresponding to Track.
Definition: track_type.h:41
TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
Definition: track_type.h:108
TRACK_BIT_VERT
Left and right track.
Definition: track_type.h:51
EngineInfo
Information about a vehicle.
Definition: engine_type.h:132
TRACKDIR_BIT_UPPER_W
Track upper, direction west.
Definition: track_type.h:117
TRACKDIR_BIT_LOWER_W
Track lower, direction west.
Definition: track_type.h:118
TRACK_BIT_X
X-axis track.
Definition: track_type.h:43
SmallVector::Contains
bool Contains(const T &item) const
Tests whether a item is present in the vector.
Definition: smallvec_type.hpp:213
DIAGDIR_SE
Southeast.
Definition: direction_type.h:83
DIAGDIR_SW
Southwest.
Definition: direction_type.h:84
RAILVEH_WAGON
simple wagon, not motorized
Definition: engine_type.h:30
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
safeguards.h
A number of safeguards to prevent using unsafe methods.
RailtypeInfo::introduces_railtypes
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced. ...
Definition: rail.h:255
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition: track_type.h:74
DIAGDIR_END
Used for iterations.
Definition: direction_type.h:86
Engine::company_avail
CompanyMask company_avail
Bit for each company whether the engine is available for that company.
Definition: engine_base.h:39
DIAGDIR_NW
Northwest.
Definition: direction_type.h:85
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:80
RailtypeInfo::label
RailTypeLabel label
Unique 32 bit rail type identifier.
Definition: rail.h:225
GetCompanyRailtypes
RailTypes GetCompanyRailtypes(CompanyID company)
Get the rail types the given company can build.
Definition: rail.cpp:257
Engine
Definition: engine_base.h:23
DIR_END
Used to iterate.
Definition: direction_type.h:36
RailVehicleInfo
Information about a rail vehicle.
Definition: engine_type.h:43
TRACKDIR_LEFT_N
Left track and direction to north.
Definition: track_type.h:88
TRACKDIR_UPPER_W
Upper track and direction to west.
Definition: track_type.h:86
TRACKDIR_Y_SE
Y-axis and direction to south-east.
Definition: track_type.h:77
TRANSPORT_RAIL
Transport by train.
Definition: transport_type.h:29
TRACKDIR_LOWER_E
Lower track and direction to east.
Definition: track_type.h:79
company_func.h
Functions related to companies.
GetTileRailType
RailType GetTileRailType(TileIndex tile)
Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
Definition: rail.cpp:157
RailtypeInfo::introduction_date
Date introduction_date
Introduction date.
Definition: rail.h:244
engine_base.h
Base class for engines.
MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
Definition: tile_type.h:52
TRACKDIR_LEFT_S
Left track and direction to south.
Definition: track_type.h:80
TRACK_BIT_LOWER
Lower track.
Definition: track_type.h:46
RAILTYPE_ELECTRIC
Electric rails.
Definition: rail_type.h:32
TRACK_BIT_UPPER
Upper track.
Definition: track_type.h:45
TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
Definition: track_type.h:115
_current_company
CompanyByte _current_company
Company currently doing an action.
Definition: company_cmd.cpp:47
TRACK_BIT_HORZ
Upper and lower track.
Definition: track_type.h:50
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
TRACKDIR_RIGHT_S
Right track and direction to south.
Definition: track_type.h:81
HasRailtypeAvail
bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
Finds out if a company has a certain railtype available.
Definition: rail.cpp:188
TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
Definition: track_type.h:116
TRACKDIR_LOWER_W
Lower track and direction to west.
Definition: track_type.h:87
MP_STATION
A tile of a station.
Definition: tile_type.h:48
RAILTYPES_NONE
No rail types.
Definition: rail_type.h:53
MAX_DAY
#define MAX_DAY
The number of days till the last day.
Definition: date_type.h:97
TrackdirBits
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
Definition: track_type.h:106
tunnelbridge_map.h
Functions that have tunnels and bridges in common.
Date
int32 Date
The type to store our dates in.
Definition: date_type.h:16
TRACKDIR_UPPER_E
Upper track and direction to east.
Definition: track_type.h:78
TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
Definition: track_type.h:109
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:105
TRACKDIR_BIT_LEFT_S
Track left, direction south.
Definition: track_type.h:112
RAILTYPE_BEGIN
Used for iterations.
Definition: rail_type.h:30
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:544
TRACKDIR_BIT_NONE
No track build.
Definition: track_type.h:107
TRACKDIR_BIT_LEFT_N
Track left, direction north.
Definition: track_type.h:119
TRACK_BIT_LEFT
Left track.
Definition: track_type.h:47
INVALID_RAILTYPE
Flag for invalid railtype.
Definition: rail_type.h:36
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:20
INVALID_TRACKDIR
Flag for an invalid trackdir.
Definition: track_type.h:93
GetRailTypeByLabel
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
Get the rail type for a given label.
Definition: rail.cpp:285
TRACKDIR_BIT_LOWER_E
Track lower, direction east.
Definition: track_type.h:111
EngineInfo::climates
byte climates
Climates supported by the engine.
Definition: engine_type.h:138
_date
Date _date
Current date in days (day counter)
Definition: date.cpp:28
TRACKDIR_X_NE
X-axis and direction to north-east.
Definition: track_type.h:76
AddDateIntroducedRailTypes
RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date)
Add the rail types that are to be introduced at the given date.
Definition: rail.cpp:225
GetRailType
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
Definition: rail_map.h:116
TRACK_BIT_Y
Y-axis track.
Definition: track_type.h:44
VEH_TRAIN
Train vehicle type.
Definition: vehicle_type.h:24