OpenTTD Source  12.0-beta2
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 
19 
25 };
26 
32 static inline bool MayHaveRoad(TileIndex t)
33 {
34  switch (GetTileType(t)) {
35  case MP_ROAD:
36  case MP_STATION:
37  case MP_TUNNELBRIDGE:
38  return true;
39 
40  default:
41  return false;
42  }
43 }
44 
52 {
53  assert(IsTileType(t, MP_ROAD));
54  return (RoadTileType)GB(_m[t].m5, 6, 2);
55 }
56 
63 static inline bool IsNormalRoad(TileIndex t)
64 {
65  return GetRoadTileType(t) == ROAD_TILE_NORMAL;
66 }
67 
73 static inline bool IsNormalRoadTile(TileIndex t)
74 {
75  return IsTileType(t, MP_ROAD) && IsNormalRoad(t);
76 }
77 
84 static inline bool IsLevelCrossing(TileIndex t)
85 {
87 }
88 
94 static inline bool IsLevelCrossingTile(TileIndex t)
95 {
96  return IsTileType(t, MP_ROAD) && IsLevelCrossing(t);
97 }
98 
105 static inline bool IsRoadDepot(TileIndex t)
106 {
107  return GetRoadTileType(t) == ROAD_TILE_DEPOT;
108 }
109 
115 static inline bool IsRoadDepotTile(TileIndex t)
116 {
117  return IsTileType(t, MP_ROAD) && IsRoadDepot(t);
118 }
119 
127 static inline RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
128 {
129  assert(IsNormalRoad(t));
130  if (rtt == RTT_TRAM) return (RoadBits)GB(_m[t].m3, 0, 4);
131  return (RoadBits)GB(_m[t].m5, 0, 4);
132 }
133 
140 static inline RoadBits GetAllRoadBits(TileIndex tile)
141 {
142  return GetRoadBits(tile, RTT_ROAD) | GetRoadBits(tile, RTT_TRAM);
143 }
144 
152 static inline void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
153 {
154  assert(IsNormalRoad(t)); // XXX incomplete
155  if (rtt == RTT_TRAM) {
156  SB(_m[t].m3, 0, 4, r);
157  } else {
158  SB(_m[t].m5, 0, 4, r);
159  }
160 }
161 
162 static inline RoadType GetRoadTypeRoad(TileIndex t)
163 {
164  assert(MayHaveRoad(t));
165  return (RoadType)GB(_m[t].m4, 0, 6);
166 }
167 
168 static inline RoadType GetRoadTypeTram(TileIndex t)
169 {
170  assert(MayHaveRoad(t));
171  return (RoadType)GB(_me[t].m8, 6, 6);
172 }
173 
174 static inline RoadType GetRoadType(TileIndex t, RoadTramType rtt)
175 {
176  return (rtt == RTT_TRAM) ? GetRoadTypeTram(t) : GetRoadTypeRoad(t);
177 }
178 
185 {
186  RoadTypes result = ROADTYPES_NONE;
187  if (MayHaveRoad(t)) {
188  if (GetRoadTypeRoad(t) != INVALID_ROADTYPE) SetBit(result, GetRoadTypeRoad(t));
189  if (GetRoadTypeTram(t) != INVALID_ROADTYPE) SetBit(result, GetRoadTypeTram(t));
190  }
191  return result;
192 }
193 
194 static inline bool HasRoadTypeRoad(TileIndex t)
195 {
196  return GetRoadTypeRoad(t) != INVALID_ROADTYPE;
197 }
198 
199 static inline bool HasRoadTypeTram(TileIndex t)
200 {
201  return GetRoadTypeTram(t) != INVALID_ROADTYPE;
202 }
203 
210 static inline bool HasTileRoadType(TileIndex t, RoadTramType rtt)
211 {
212  return GetRoadType(t, rtt) != INVALID_ROADTYPE;
213 }
214 
221 static inline bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
222 {
223  if (!MayHaveRoad(t)) return false;
224  return (GetPresentRoadTypes(t) & rts);
225 }
226 
233 static inline Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
234 {
235  assert(MayHaveRoad(t));
236  if (rtt == RTT_ROAD) return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
237 
238  /* Trams don't need OWNER_TOWN, and remapping OWNER_NONE
239  * to OWNER_TOWN makes it use one bit less */
240  Owner o = (Owner)GB(_m[t].m3, 4, 4);
241  return o == OWNER_TOWN ? OWNER_NONE : o;
242 }
243 
250 static inline void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
251 {
252  if (rtt == RTT_ROAD) {
253  SB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5, o);
254  } else {
255  SB(_m[t].m3, 4, 4, o == OWNER_NONE ? OWNER_TOWN : o);
256  }
257 }
258 
267 static inline bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
268 {
269  assert(HasTileRoadType(t, rtt));
270  return (GetRoadOwner(t, rtt) == o);
271 }
272 
279 static inline bool HasTownOwnedRoad(TileIndex t)
280 {
281  return HasTileRoadType(t, RTT_ROAD) && IsRoadOwner(t, RTT_ROAD, OWNER_TOWN);
282 }
283 
291 };
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:279
GetRoadDepotDirection
static DiagDirection GetRoadDepotDirection(TileIndex t)
Get the direction of the exit of a road depot.
Definition: road_map.h:565
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
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:221
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:23
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
OtherAxis
static Axis OtherAxis(Axis a)
Select the other axis as provided.
Definition: direction_func.h:197
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition: road_type.h:27
IsRoadDepotTile
static bool IsRoadDepotTile(TileIndex t)
Return whether a tile is a road depot tile.
Definition: road_map.h:115
road_func.h
DepotID
uint16 DepotID
Type for the unique identifier of depots.
Definition: depot_type.h:13
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:21
ROAD_X
@ ROAD_X
Full road along the x-axis (south-west + north-east)
Definition: road_type.h:56
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:250
GetPresentRoadTypes
static RoadTypes GetPresentRoadTypes(TileIndex t)
Get the present road types of a tile.
Definition: road_map.h:184
Window::owner
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
Definition: window_gui.h:319
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:152
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:48
GetCrossingRailTrack
static Track GetCrossingRailTrack(TileIndex tile)
Get the rail track of a level crossing.
Definition: road_map.h:358
IsLevelCrossing
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
Definition: road_map.h:84
IncreaseRoadWorksCounter
static bool IncreaseRoadWorksCounter(TileIndex t)
Increase the progress counter of road works.
Definition: road_map.h:523
RoadBits
RoadBits
Enumeration for the road parts on a tile.
Definition: road_type.h:50
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:140
ROAD_TILE_NORMAL
@ ROAD_TILE_NORMAL
Normal road.
Definition: road_map.h:22
DRD_NORTHBOUND
@ DRD_NORTHBOUND
All northbound traffic is disallowed.
Definition: road_map.h:288
GetRoadBits
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
Definition: road_map.h:127
DRD_END
@ DRD_END
Sentinel.
Definition: road_map.h:290
ROADSIDE_STREET_LIGHTS
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
Definition: road_map.h:481
EnumPropsT
Informative template class exposing basic enumeration properties used by several other templates belo...
Definition: enum_type.hpp:48
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
DRD_NONE
@ DRD_NONE
None of the directions are disallowed.
Definition: road_map.h:286
IsNormalRoad
static bool IsNormalRoad(TileIndex t)
Return whether a tile is a normal road.
Definition: road_map.h:63
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:267
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:210
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:51
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:55
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:105
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
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:22
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
DisallowedRoadDirections
DisallowedRoadDirections
Which directions are disallowed ?
Definition: road_map.h:285
DRD_BOTH
@ DRD_BOTH
All directions are disallowed.
Definition: road_map.h:289
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:24
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:51
GetCrossingRailAxis
static Axis GetCrossingRailAxis(TileIndex t)
Get the rail axis of a level crossing.
Definition: road_map.h:337
ROAD_Y
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
Definition: road_type.h:57
track_func.h
BarCrossing
static void BarCrossing(TileIndex t)
Bar a level crossing.
Definition: road_map.h:447
IsLevelCrossingTile
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
Definition: road_map.h:94
rail_type.h
MakeEnumPropsT
Helper template class that makes basic properties of given enumeration type visible from outsize.
Definition: enum_type.hpp:62
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
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
DRD_SOUTHBOUND
@ DRD_SOUTHBOUND
All southbound traffic is disallowed.
Definition: road_map.h:287
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:73
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:123
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:233
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
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:32
AXIS_X
@ AXIS_X
The X axis.
Definition: direction_type.h:124