OpenTTD Source  13.2.1
road_map.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef ROAD_MAP_H
11 #define ROAD_MAP_H
12 
13 #include "track_func.h"
14 #include "depot_type.h"
15 #include "rail_type.h"
16 #include "road_func.h"
17 #include "tile_map.h"
18 #include "road_type.h"
19 
20 
26 };
27 
33 static inline bool MayHaveRoad(TileIndex t)
34 {
35  switch (GetTileType(t)) {
36  case MP_ROAD:
37  case MP_STATION:
38  case MP_TUNNELBRIDGE:
39  return true;
40 
41  default:
42  return false;
43  }
44 }
45 
53 {
54  assert(IsTileType(t, MP_ROAD));
55  return (RoadTileType)GB(_m[t].m5, 6, 2);
56 }
57 
64 static inline bool IsNormalRoad(TileIndex t)
65 {
66  return GetRoadTileType(t) == ROAD_TILE_NORMAL;
67 }
68 
74 static inline bool IsNormalRoadTile(TileIndex t)
75 {
76  return IsTileType(t, MP_ROAD) && IsNormalRoad(t);
77 }
78 
85 static inline bool IsLevelCrossing(TileIndex t)
86 {
88 }
89 
95 static inline bool IsLevelCrossingTile(TileIndex t)
96 {
97  return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
98 }
99 
106 static inline bool IsRoadDepot(TileIndex t)
107 {
108  return GetRoadTileType(t) == ROAD_TILE_DEPOT;
109 }
110 
116 static inline bool IsRoadDepotTile(TileIndex t)
117 {
118  return IsTileType(t, MP_ROAD) && IsRoadDepot(t);
119 }
120 
128 static inline RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
129 {
130  assert(IsNormalRoad(t));
131  if (rtt == RTT_TRAM) return (RoadBits)GB(_m[t].m3, 0, 4);
132  return (RoadBits)GB(_m[t].m5, 0, 4);
133 }
134 
141 static inline RoadBits GetAllRoadBits(TileIndex tile)
142 {
143  return GetRoadBits(tile, RTT_ROAD) | GetRoadBits(tile, RTT_TRAM);
144 }
145 
153 static inline void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
154 {
155  assert(IsNormalRoad(t)); // XXX incomplete
156  if (rtt == RTT_TRAM) {
157  SB(_m[t].m3, 0, 4, r);
158  } else {
159  SB(_m[t].m5, 0, 4, r);
160  }
161 }
162 
163 static inline RoadType GetRoadTypeRoad(TileIndex t)
164 {
165  assert(MayHaveRoad(t));
166  return (RoadType)GB(_m[t].m4, 0, 6);
167 }
168 
169 static inline RoadType GetRoadTypeTram(TileIndex t)
170 {
171  assert(MayHaveRoad(t));
172  return (RoadType)GB(_me[t].m8, 6, 6);
173 }
174 
175 static inline RoadType GetRoadType(TileIndex t, RoadTramType rtt)
176 {
177  return (rtt == RTT_TRAM) ? GetRoadTypeTram(t) : GetRoadTypeRoad(t);
178 }
179 
186 {
187  RoadTypes result = ROADTYPES_NONE;
188  if (MayHaveRoad(t)) {
189  if (GetRoadTypeRoad(t) != INVALID_ROADTYPE) SetBit(result, GetRoadTypeRoad(t));
190  if (GetRoadTypeTram(t) != INVALID_ROADTYPE) SetBit(result, GetRoadTypeTram(t));
191  }
192  return result;
193 }
194 
195 static inline bool HasRoadTypeRoad(TileIndex t)
196 {
197  return GetRoadTypeRoad(t) != INVALID_ROADTYPE;
198 }
199 
200 static inline bool HasRoadTypeTram(TileIndex t)
201 {
202  return GetRoadTypeTram(t) != INVALID_ROADTYPE;
203 }
204 
211 static inline bool HasTileRoadType(TileIndex t, RoadTramType rtt)
212 {
213  return GetRoadType(t, rtt) != INVALID_ROADTYPE;
214 }
215 
222 static inline bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
223 {
224  if (!MayHaveRoad(t)) return false;
225  return (GetPresentRoadTypes(t) & rts);
226 }
227 
234 static inline Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
235 {
236  assert(MayHaveRoad(t));
237  if (rtt == RTT_ROAD) return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
238 
239  /* Trams don't need OWNER_TOWN, and remapping OWNER_NONE
240  * to OWNER_TOWN makes it use one bit less */
241  Owner o = (Owner)GB(_m[t].m3, 4, 4);
242  return o == OWNER_TOWN ? OWNER_NONE : o;
243 }
244 
251 static inline void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
252 {
253  if (rtt == RTT_ROAD) {
254  SB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5, o);
255  } else {
256  SB(_m[t].m3, 4, 4, o == OWNER_NONE ? OWNER_TOWN : o);
257  }
258 }
259 
268 static inline bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
269 {
270  assert(HasTileRoadType(t, rtt));
271  return (GetRoadOwner(t, rtt) == o);
272 }
273 
280 static inline bool HasTownOwnedRoad(TileIndex t)
281 {
282  return HasTileRoadType(t, RTT_ROAD) && IsRoadOwner(t, RTT_ROAD, OWNER_TOWN);
283 }
284 
292 {
293  return drt < DRD_END;
294 }
295 
302 {
303  assert(IsNormalRoad(t));
304  return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
305 }
306 
313 {
314  assert(IsNormalRoad(t));
315  assert(drd < DRD_END);
316  SB(_m[t].m5, 4, 2, drd);
317 }
318 
326 {
327  assert(IsLevelCrossing(t));
328  return (Axis)GB(_m[t].m5, 0, 1);
329 }
330 
338 {
339  assert(IsLevelCrossing(t));
340  return OtherAxis((Axis)GetCrossingRoadAxis(t));
341 }
342 
349 {
350  return GetCrossingRoadAxis(tile) == AXIS_X ? ROAD_X : ROAD_Y;
351 }
352 
359 {
360  return AxisToTrack(GetCrossingRailAxis(tile));
361 }
362 
369 {
370  return AxisToTrackBits(GetCrossingRailAxis(tile));
371 }
372 
373 
380 static inline bool HasCrossingReservation(TileIndex t)
381 {
382  assert(IsLevelCrossingTile(t));
383  return HasBit(_m[t].m5, 4);
384 }
385 
393 static inline void SetCrossingReservation(TileIndex t, bool b)
394 {
395  assert(IsLevelCrossingTile(t));
396  SB(_m[t].m5, 4, 1, b ? 1 : 0);
397 }
398 
406 {
408 }
409 
416 static inline bool IsCrossingBarred(TileIndex t)
417 {
418  assert(IsLevelCrossing(t));
419  return HasBit(_m[t].m5, 5);
420 }
421 
428 static inline void SetCrossingBarred(TileIndex t, bool barred)
429 {
430  assert(IsLevelCrossing(t));
431  SB(_m[t].m5, 5, 1, barred ? 1 : 0);
432 }
433 
438 static inline void UnbarCrossing(TileIndex t)
439 {
440  SetCrossingBarred(t, false);
441 }
442 
447 static inline void BarCrossing(TileIndex t)
448 {
449  SetCrossingBarred(t, true);
450 }
451 
453 #define IsOnDesert IsOnSnow
454 
459 static inline bool IsOnSnow(TileIndex t)
460 {
461  return HasBit(_me[t].m7, 5);
462 }
463 
465 #define ToggleDesert ToggleSnow
466 
470 static inline void ToggleSnow(TileIndex t)
471 {
472  ToggleBit(_me[t].m7, 5);
473 }
474 
475 
477 enum Roadside {
482  // 4 is unused for historical reasons
486 };
487 
493 static inline Roadside GetRoadside(TileIndex tile)
494 {
495  return (Roadside)GB(_me[tile].m6, 3, 3);
496 }
497 
503 static inline void SetRoadside(TileIndex tile, Roadside s)
504 {
505  SB(_me[tile].m6, 3, 3, s);
506 }
507 
513 static inline bool HasRoadWorks(TileIndex t)
514 {
516 }
517 
523 static inline bool IncreaseRoadWorksCounter(TileIndex t)
524 {
525  AB(_me[t].m7, 0, 4, 1);
526 
527  return GB(_me[t].m7, 0, 4) == 15;
528 }
529 
535 static inline void StartRoadWorks(TileIndex t)
536 {
537  assert(!HasRoadWorks(t));
538  /* Remove any trees or lamps in case or roadwork */
539  switch (GetRoadside(t)) {
540  case ROADSIDE_BARREN:
542  default: SetRoadside(t, ROADSIDE_PAVED_ROAD_WORKS); break;
543  }
544 }
545 
551 static inline void TerminateRoadWorks(TileIndex t)
552 {
553  assert(HasRoadWorks(t));
555  /* Stop the counter */
556  SB(_me[t].m7, 0, 4, 0);
557 }
558 
559 
566 {
567  assert(IsRoadDepot(t));
568  return (DiagDirection)GB(_m[t].m5, 0, 2);
569 }
570 
571 
572 RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance = false);
573 
579 static inline void SetRoadTypeRoad(TileIndex t, RoadType rt)
580 {
581  assert(MayHaveRoad(t));
582  assert(rt == INVALID_ROADTYPE || RoadTypeIsRoad(rt));
583  SB(_m[t].m4, 0, 6, rt);
584 }
585 
591 static inline void SetRoadTypeTram(TileIndex t, RoadType rt)
592 {
593  assert(MayHaveRoad(t));
594  assert(rt == INVALID_ROADTYPE || RoadTypeIsTram(rt));
595  SB(_me[t].m8, 6, 6, rt);
596 }
597 
604 static inline void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
605 {
606  if (rtt == RTT_TRAM) {
607  SetRoadTypeTram(t, rt);
608  } else {
609  SetRoadTypeRoad(t, rt);
610  }
611 }
612 
619 static inline void SetRoadTypes(TileIndex t, RoadType road_rt, RoadType tram_rt)
620 {
621  SetRoadTypeRoad(t, road_rt);
622  SetRoadTypeTram(t, tram_rt);
623 }
624 
635 static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
636 {
637  SetTileType(t, MP_ROAD);
638  SetTileOwner(t, road);
639  _m[t].m2 = town;
640  _m[t].m3 = (tram_rt != INVALID_ROADTYPE ? bits : 0);
641  _m[t].m5 = (road_rt != INVALID_ROADTYPE ? bits : 0) | ROAD_TILE_NORMAL << 6;
642  SB(_me[t].m6, 2, 4, 0);
643  _me[t].m7 = 0;
644  SetRoadTypes(t, road_rt, tram_rt);
645  SetRoadOwner(t, RTT_TRAM, tram);
646 }
647 
660 static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
661 {
662  SetTileType(t, MP_ROAD);
663  SetTileOwner(t, rail);
664  _m[t].m2 = town;
665  _m[t].m3 = 0;
666  _m[t].m4 = INVALID_ROADTYPE;
667  _m[t].m5 = ROAD_TILE_CROSSING << 6 | roaddir;
668  SB(_me[t].m6, 2, 4, 0);
669  _me[t].m7 = road;
670  _me[t].m8 = INVALID_ROADTYPE << 6 | rat;
671  SetRoadTypes(t, road_rt, tram_rt);
672  SetRoadOwner(t, RTT_TRAM, tram);
673 }
674 
683 static inline void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
684 {
685  SetTileType(t, MP_ROAD);
686  SetTileOwner(t, owner);
687  _m[t].m2 = did;
688  _m[t].m3 = 0;
689  _m[t].m4 = INVALID_ROADTYPE;
690  _m[t].m5 = ROAD_TILE_DEPOT << 6 | dir;
691  SB(_me[t].m6, 2, 4, 0);
692  _me[t].m7 = owner;
693  _me[t].m8 = INVALID_ROADTYPE << 6;
694  SetRoadType(t, GetRoadTramType(rt), rt);
695  SetRoadOwner(t, RTT_TRAM, owner);
696 }
697 
698 #endif /* ROAD_MAP_H */
HasTownOwnedRoad
static bool HasTownOwnedRoad(TileIndex t)
Checks if given tile has town owned road.
Definition: road_map.h:280
GetRoadDepotDirection
static DiagDirection GetRoadDepotDirection(TileIndex t)
Get the direction of the exit of a road depot.
Definition: road_map.h:565
TRACK_BIT_NONE
@ TRACK_BIT_NONE
No track.
Definition: track_type.h:39
HasTileAnyRoadType
static bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
Check if a tile has one of the specified road types.
Definition: road_map.h:222
GB
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Definition: bitmath_func.hpp:32
ROAD_TILE_CROSSING
@ ROAD_TILE_CROSSING
Level crossing.
Definition: road_map.h:24
SetTileType
static void SetTileType(TileIndex tile, TileType type)
Set the type of a tile.
Definition: tile_map.h:131
SetRoadTypeTram
static void SetRoadTypeTram(TileIndex t, RoadType rt)
Set the tram road type of a tile.
Definition: road_map.h:591
IsValidDisallowedRoadDirections
static bool IsValidDisallowedRoadDirections(DisallowedRoadDirections drt)
Checks if a DisallowedRoadDirections is valid.
Definition: road_map.h:291
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:125
OtherAxis
static Axis OtherAxis(Axis a)
Select the other axis as provided.
Definition: direction_func.h:197
IsRoadDepotTile
static bool IsRoadDepotTile(TileIndex t)
Return whether a tile is a road depot tile.
Definition: road_map.h:116
road_func.h
DepotID
uint16 DepotID
Type for the unique identifier of depots.
Definition: depot_type.h:15
AxisToTrackBits
static TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
Definition: track_func.h:87
GetCrossingReservationTrackBits
static TrackBits GetCrossingReservationTrackBits(TileIndex t)
Get the reserved track bits for a rail crossing.
Definition: road_map.h:405
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
_me
TileExtended * _me
Extended Tiles of the map.
Definition: map.cpp:31
RoadTileType
RoadTileType
The different types of road tiles.
Definition: road_map.h:22
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
SetRoadTypeRoad
static void SetRoadTypeRoad(TileIndex t, RoadType rt)
Set the road road type of a tile.
Definition: road_map.h:579
Tile::m2
uint16 m2
Primarily used for indices to towns, industries and stations.
Definition: map_type.h:20
ROADSIDE_BARREN
@ ROADSIDE_BARREN
Road on barren land.
Definition: road_map.h:478
SetCrossingReservation
static void SetCrossingReservation(TileIndex t, bool b)
Set the reservation state of the rail crossing.
Definition: road_map.h:393
SetRoadOwner
static void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
Definition: road_map.h:251
GetPresentRoadTypes
static RoadTypes GetPresentRoadTypes(TileIndex t)
Get the present road types of a tile.
Definition: road_map.h:185
Window::owner
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
Definition: window_gui.h:253
AB
static T AB(T &x, const uint8 s, const uint8 n, const U i)
Add i to n bits of x starting at bit s.
Definition: bitmath_func.hpp:83
GetCrossingRoadBits
static RoadBits GetCrossingRoadBits(TileIndex tile)
Get the road bits of a level crossing.
Definition: road_map.h:348
SetRoadBits
static void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
Set the present road bits for a specific road type.
Definition: road_map.h:153
StartRoadWorks
static void StartRoadWorks(TileIndex t)
Start road works on a tile.
Definition: road_map.h:535
SetRoadTypes
static void SetRoadTypes(TileIndex t, RoadType road_rt, RoadType tram_rt)
Set the present road types of a tile.
Definition: road_map.h:619
TerminateRoadWorks
static void TerminateRoadWorks(TileIndex t)
Terminate road works on a tile.
Definition: road_map.h:551
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
MP_ROAD
@ MP_ROAD
A tile with road (or tram tracks)
Definition: tile_type.h:50
GetCrossingRailTrack
static Track GetCrossingRailTrack(TileIndex tile)
Get the rail track of a level crossing.
Definition: road_map.h:358
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition: road_type.h:27
IsLevelCrossing
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
Definition: road_map.h:85
IncreaseRoadWorksCounter
static bool IncreaseRoadWorksCounter(TileIndex t)
Increase the progress counter of road works.
Definition: road_map.h:523
ROAD_X
@ ROAD_X
Full road along the x-axis (south-west + north-east)
Definition: road_type.h:56
Roadside
Roadside
The possible road side decorations.
Definition: road_map.h:477
GetAllRoadBits
static RoadBits GetAllRoadBits(TileIndex tile)
Get all set RoadBits on the given tile.
Definition: road_map.h:141
ROAD_TILE_NORMAL
@ ROAD_TILE_NORMAL
Normal road.
Definition: road_map.h:23
ROAD_Y
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
Definition: road_type.h:57
GetRoadBits
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
Definition: road_map.h:128
ROADSIDE_STREET_LIGHTS
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
Definition: road_map.h:481
tile_map.h
ROADSIDE_GRASS
@ ROADSIDE_GRASS
Road on grass.
Definition: road_map.h:479
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:27
AxisToTrack
static Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
Definition: track_func.h:65
IsNormalRoad
static bool IsNormalRoad(TileIndex t)
Return whether a tile is a normal road.
Definition: road_map.h:64
ToggleSnow
static void ToggleSnow(TileIndex t)
Toggle the snow/desert state of a road tile.
Definition: road_map.h:470
SB
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
Definition: bitmath_func.hpp:58
MakeRoadCrossing
static void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
Make a level crossing.
Definition: road_map.h:660
IsRoadOwner
static bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Check if a specific road type is owned by an owner.
Definition: road_map.h:268
GetRoadside
static Roadside GetRoadside(TileIndex tile)
Get the decorations of a road.
Definition: road_map.h:493
ROADSIDE_PAVED
@ ROADSIDE_PAVED
Road with paved sidewalks.
Definition: road_map.h:480
RoadTypes
RoadTypes
The different roadtypes we support, but then a bitmask of them.
Definition: road_type.h:36
HasTileRoadType
static bool HasTileRoadType(TileIndex t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
Definition: road_map.h:211
DisallowedRoadDirections
DisallowedRoadDirections
Which directions are disallowed ?
Definition: road_type.h:72
IsCrossingBarred
static bool IsCrossingBarred(TileIndex t)
Check if the level crossing is barred.
Definition: road_map.h:416
GetRoadTileType
static RoadTileType GetRoadTileType(TileIndex t)
Get the type of the road tile.
Definition: road_map.h:52
IsOnSnow
static bool IsOnSnow(TileIndex t)
Check if a road tile has snow/desert.
Definition: road_map.h:459
MP_TUNNELBRIDGE
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
Definition: tile_type.h:57
HasCrossingReservation
static bool HasCrossingReservation(TileIndex t)
Get the reservation state of the rail crossing.
Definition: road_map.h:380
IsRoadDepot
static bool IsRoadDepot(TileIndex t)
Return whether a tile is a road depot.
Definition: road_map.h:106
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:77
ROADSIDE_TREES
@ ROADSIDE_TREES
Road with trees on paved sidewalks.
Definition: road_map.h:483
IsTileType
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Definition: tile_map.h:150
SetRoadType
static void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
Set the road type of a tile.
Definition: road_map.h:604
GetDisallowedRoadDirections
static DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
Gets the disallowed directions.
Definition: road_map.h:301
Tile::m5
byte m5
General purpose.
Definition: map_type.h:24
GetAnyRoadBits
RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance=false)
Returns the RoadBits on an arbitrary tile Special behaviour:
Definition: road_map.cpp:33
SetDisallowedRoadDirections
static void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
Sets the disallowed directions.
Definition: road_map.h:312
ROAD_TILE_DEPOT
@ ROAD_TILE_DEPOT
Depot (one entrance)
Definition: road_map.h:25
depot_type.h
OWNER_NONE
@ OWNER_NONE
The tile has no ownership.
Definition: company_type.h:25
MakeRoadNormal
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
Definition: road_map.h:635
MP_STATION
@ MP_STATION
A tile of a station.
Definition: tile_type.h:53
GetCrossingRailAxis
static Axis GetCrossingRailAxis(TileIndex t)
Get the rail axis of a level crossing.
Definition: road_map.h:337
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:22
track_func.h
BarCrossing
static void BarCrossing(TileIndex t)
Bar a level crossing.
Definition: road_map.h:447
RoadBits
RoadBits
Enumeration for the road parts on a tile.
Definition: road_type.h:50
IsLevelCrossingTile
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
Definition: road_map.h:95
rail_type.h
AXIS_X
@ AXIS_X
The X axis.
Definition: direction_type.h:126
TrackBits
TrackBits
Bitfield corresponding to Track.
Definition: track_type.h:38
ToggleBit
static T ToggleBit(T &x, const uint8 y)
Toggles a bit in a variable.
Definition: bitmath_func.hpp:181
SetBit
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
road_type.h
TileExtended::m7
byte m7
Primarily used for newgrf support.
Definition: map_type.h:35
IsNormalRoadTile
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
Definition: road_map.h:74
SetRoadside
static void SetRoadside(TileIndex tile, Roadside s)
Set the decorations of a road.
Definition: road_map.h:503
UnbarCrossing
static void UnbarCrossing(TileIndex t)
Unbar a level crossing.
Definition: road_map.h:438
MakeRoadDepot
static void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
Make a road depot.
Definition: road_map.h:683
GetRoadOwner
static Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
Get the owner of a specific road type.
Definition: road_map.h:234
GetCrossingRoadAxis
static Axis GetCrossingRoadAxis(TileIndex t)
Get the road axis of a level crossing.
Definition: road_map.h:325
SetTileOwner
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
Definition: tile_map.h:198
GetTileType
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Definition: tile_map.h:96
SetCrossingBarred
static void SetCrossingBarred(TileIndex t, bool barred)
Set the bar state of a level crossing.
Definition: road_map.h:428
ROADSIDE_PAVED_ROAD_WORKS
@ ROADSIDE_PAVED_ROAD_WORKS
Road with sidewalks and road works.
Definition: road_map.h:485
Tile::m3
byte m3
General purpose.
Definition: map_type.h:22
Track
Track
These are used to specify a single track.
Definition: track_type.h:19
GetCrossingRailBits
static TrackBits GetCrossingRailBits(TileIndex tile)
Get the rail track bits of a level crossing.
Definition: road_map.h:368
ROADTYPES_NONE
@ ROADTYPES_NONE
No roadtypes.
Definition: road_type.h:37
TileExtended::m8
uint16 m8
General purpose.
Definition: map_type.h:36
HasRoadWorks
static bool HasRoadWorks(TileIndex t)
Check if a tile has road works.
Definition: road_map.h:513
Tile::m4
byte m4
General purpose.
Definition: map_type.h:23
_m
Tile * _m
Tiles of the map.
Definition: map.cpp:30
OWNER_TOWN
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
Definition: company_type.h:24
DRD_END
@ DRD_END
Sentinel.
Definition: road_type.h:77
ROADSIDE_GRASS_ROAD_WORKS
@ ROADSIDE_GRASS_ROAD_WORKS
Road on grass with road works.
Definition: road_map.h:484
MayHaveRoad
static bool MayHaveRoad(TileIndex t)
Test whether a tile can have road/tram types.
Definition: road_map.h:33