OpenTTD Source: src/station_map.h Source File

OpenTTD Source 15.3

station_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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef STATION_MAP_H
11#define STATION_MAP_H
12
13#include "rail_map.h"
14#include "road_map.h"
15#include "water_map.h"
16#include "station_func.h"
17#include "rail.h"
18#include "road.h"
19
20 typedef uint8_t StationGfx;
21
28 inline StationID GetStationIndex(Tile t)
29{
30 assert(IsTileType(t, MP_STATION));
31 return (StationID)t.m2();
32}
33
34
35 static const int GFX_DOCK_BASE_WATER_PART = 4;
36 static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4;
37
44 inline StationType GetStationType(Tile t)
45{
46 assert(IsTileType(t, MP_STATION));
47 return (StationType)GB(t.m6(), 3, 4);
48}
49
56 inline RoadStopType GetRoadStopType(Tile t)
57{
58 assert(GetStationType(t) == StationType::Truck || GetStationType(t) == StationType::Bus);
59 return GetStationType(t) == StationType::Truck ? RoadStopType::Truck : RoadStopType::Bus;
60}
61
68 inline StationGfx GetStationGfx(Tile t)
69{
70 assert(IsTileType(t, MP_STATION));
71 return t.m5();
72}
73
80 inline void SetStationGfx(Tile t, StationGfx gfx)
81{
82 assert(IsTileType(t, MP_STATION));
83 t.m5() = gfx;
84}
85
92 inline bool IsRailStation(Tile t)
93{
94 return GetStationType(t) == StationType::Rail;
95}
96
102 inline bool IsRailStationTile(Tile t)
103{
104 return IsTileType(t, MP_STATION) && IsRailStation(t);
105}
106
113 inline bool IsRailWaypoint(Tile t)
114{
115 return GetStationType(t) == StationType::RailWaypoint;
116}
117
123 inline bool IsRailWaypointTile(Tile t)
124{
125 return IsTileType(t, MP_STATION) && IsRailWaypoint(t);
126}
127
135 inline bool HasStationRail(Tile t)
136{
137 return IsRailStation(t) || IsRailWaypoint(t);
138}
139
146 inline bool HasStationTileRail(Tile t)
147{
148 return IsTileType(t, MP_STATION) && HasStationRail(t);
149}
150
157 inline bool IsAirport(Tile t)
158{
159 return GetStationType(t) == StationType::Airport;
160}
161
167 inline bool IsAirportTile(Tile t)
168{
169 return IsTileType(t, MP_STATION) && IsAirport(t);
170}
171
172bool IsHangar(Tile t);
173
180 inline bool IsTruckStop(Tile t)
181{
182 return GetStationType(t) == StationType::Truck;
183}
184
191 inline bool IsBusStop(Tile t)
192{
193 return GetStationType(t) == StationType::Bus;
194}
195
202 inline bool IsRoadWaypoint(Tile t)
203{
204 return GetStationType(t) == StationType::RoadWaypoint;
205}
206
212 inline bool IsRoadWaypointTile(Tile t)
213{
214 return IsTileType(t, MP_STATION) && IsRoadWaypoint(t);
215}
216
223 inline bool IsStationRoadStop(Tile t)
224{
225 assert(IsTileType(t, MP_STATION));
226 return IsTruckStop(t) || IsBusStop(t);
227}
228
234 inline bool IsStationRoadStopTile(Tile t)
235{
236 return IsTileType(t, MP_STATION) && IsStationRoadStop(t);
237}
238
245 inline bool IsAnyRoadStop(Tile t)
246{
247 assert(IsTileType(t, MP_STATION));
248 return IsTruckStop(t) || IsBusStop(t) || IsRoadWaypoint(t);
249}
250
256 inline bool IsAnyRoadStopTile(Tile t)
257{
258 return IsTileType(t, MP_STATION) && IsAnyRoadStop(t);
259}
260
266 inline bool IsBayRoadStopTile(Tile t)
267{
268 return IsStationRoadStopTile(t) && GetStationGfx(t) < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
269}
270
276 inline bool IsDriveThroughStopTile(Tile t)
277{
278 return IsAnyRoadStopTile(t) && GetStationGfx(t) >= GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
279}
280
281 StationGfx GetTranslatedAirportTileID(StationGfx gfx);
282
288 static inline Roadside GetRoadWaypointRoadside(Tile tile)
289{
290 assert(IsRoadWaypointTile(tile));
291 return static_cast<Roadside>(GB(tile.m3(), 2, 2));
292}
293
299 static inline void SetRoadWaypointRoadside(Tile tile, Roadside s)
300{
301 assert(IsRoadWaypointTile(tile));
302 SB(tile.m3(), 2, 2, to_underlying(s));
303}
304
310 static inline bool IsRoadWaypointOnSnowOrDesert(Tile t)
311{
312 assert(IsRoadWaypointTile(t));
313 return HasBit(t.m8(), 15);
314}
315
320 static inline void ToggleRoadWaypointOnSnowOrDesert(Tile t)
321{
322 assert(IsRoadWaypointTile(t));
323 ToggleBit(t.m8(), 15);
324}
325
332 inline StationGfx GetAirportGfx(Tile t)
333{
334 assert(IsAirport(t));
335 return GetTranslatedAirportTileID(GetStationGfx(t));
336}
337
344 inline DiagDirection GetBayRoadStopDir(Tile t)
345{
346 assert(IsBayRoadStopTile(t));
347 return static_cast<DiagDirection>(GetStationGfx(t));
348}
349
356 inline Axis GetDriveThroughStopAxis(Tile t)
357{
358 assert(IsDriveThroughStopTile(t));
359 return static_cast<Axis>(GetStationGfx(t) - GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
360}
361
368 inline bool IsOilRig(Tile t)
369{
370 return GetStationType(t) == StationType::Oilrig;
371}
372
379 inline bool IsDock(Tile t)
380{
381 return GetStationType(t) == StationType::Dock;
382}
383
389 inline bool IsDockTile(Tile t)
390{
391 return IsTileType(t, MP_STATION) && GetStationType(t) == StationType::Dock;
392}
393
400 inline bool IsBuoy(Tile t)
401{
402 return GetStationType(t) == StationType::Buoy;
403}
404
410 inline bool IsBuoyTile(Tile t)
411{
412 return IsTileType(t, MP_STATION) && IsBuoy(t);
413}
414
420 inline bool IsHangarTile(Tile t)
421{
422 return IsTileType(t, MP_STATION) && IsHangar(t);
423}
424
431 inline bool IsStationTileBlocked(Tile t)
432{
433 assert(HasStationRail(t));
434 return HasBit(t.m3(), 0);
435}
436
443 inline void SetStationTileBlocked(Tile t, bool b)
444{
445 assert(HasStationRail(t));
446 AssignBit(t.m3(), 0, b);
447}
448
455 inline bool CanStationTileHaveWires(Tile t)
456{
457 assert(HasStationRail(t));
458 return HasBit(t.m3(), 1);
459}
460
467 inline void SetStationTileHaveWires(Tile t, bool b)
468{
469 assert(HasStationRail(t));
470 AssignBit(t.m3(), 1, b);
471}
472
479 inline bool CanStationTileHavePylons(Tile t)
480{
481 assert(HasStationRail(t));
482 return HasBit(t.m3(), 2);
483}
484
491 inline void SetStationTileHavePylons(Tile t, bool b)
492{
493 assert(HasStationRail(t));
494 AssignBit(t.m3(), 2, b);
495}
496
503 inline Axis GetRailStationAxis(Tile t)
504{
505 assert(HasStationRail(t));
506 return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
507}
508
515 inline Track GetRailStationTrack(Tile t)
516{
517 return AxisToTrack(GetRailStationAxis(t));
518}
519
526 inline TrackBits GetRailStationTrackBits(Tile t)
527{
528 return AxisToTrackBits(GetRailStationAxis(t));
529}
530
544 inline bool IsCompatibleTrainStationTile(Tile test_tile, Tile station_tile)
545{
546 assert(IsRailStationTile(station_tile));
547 return IsRailStationTile(test_tile) && !IsStationTileBlocked(test_tile) &&
548 IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) &&
549 GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) &&
550 GetStationIndex(test_tile) == GetStationIndex(station_tile);
551}
552
559 inline bool HasStationReservation(Tile t)
560{
561 assert(HasStationRail(t));
562 return HasBit(t.m6(), 2);
563}
564
571 inline void SetRailStationReservation(Tile t, bool b)
572{
573 assert(HasStationRail(t));
574 AssignBit(t.m6(), 2, b);
575}
576
583 inline TrackBits GetStationReservationTrackBits(Tile t)
584{
585 return HasStationReservation(t) ? GetRailStationTrackBits(t) : TRACK_BIT_NONE;
586}
587
595 inline DiagDirection GetDockDirection(Tile t)
596{
597 StationGfx gfx = GetStationGfx(t);
598 assert(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART);
599 return (DiagDirection)(gfx);
600}
601
605 inline bool IsDockWaterPart(Tile t)
606{
607 assert(IsDockTile(t));
608 StationGfx gfx = GetStationGfx(t);
609 return gfx >= GFX_DOCK_BASE_WATER_PART;
610}
611
618 inline bool IsCustomStationSpecIndex(Tile t)
619{
620 assert(HasStationTileRail(t));
621 return t.m4() != 0;
622}
623
630 inline void SetCustomStationSpecIndex(Tile t, uint8_t specindex)
631{
632 assert(HasStationTileRail(t));
633 t.m4() = specindex;
634}
635
642 inline uint GetCustomStationSpecIndex(Tile t)
643{
644 assert(HasStationTileRail(t));
645 return t.m4();
646}
647
654 inline bool IsCustomRoadStopSpecIndex(Tile t)
655{
656 assert(IsAnyRoadStopTile(t));
657 return GB(t.m8(), 0, 6) != 0;
658}
659
666 inline void SetCustomRoadStopSpecIndex(Tile t, uint8_t specindex)
667{
668 assert(IsAnyRoadStopTile(t));
669 SB(t.m8(), 0, 6, specindex);
670}
671
678 inline uint GetCustomRoadStopSpecIndex(Tile t)
679{
680 assert(IsAnyRoadStopTile(t));
681 return GB(t.m8(), 0, 6);
682}
683
690 inline void SetStationTileRandomBits(Tile t, uint8_t random_bits)
691{
692 assert(IsTileType(t, MP_STATION));
693 SB(t.m3(), 4, 4, random_bits);
694}
695
702 inline uint8_t GetStationTileRandomBits(Tile t)
703{
704 assert(IsTileType(t, MP_STATION));
705 return GB(t.m3(), 4, 4);
706}
707
717 inline void MakeStation(Tile t, Owner o, StationID sid, StationType st, uint8_t section, WaterClass wc = WaterClass::Invalid)
718{
719 SetTileType(t, MP_STATION);
720 SetTileOwner(t, o);
721 SetWaterClass(t, wc);
722 SetDockingTile(t, false);
723 t.m2() = sid.base();
724 t.m3() = 0;
725 t.m4() = 0;
726 t.m5() = section;
727 SB(t.m6(), 2, 1, 0);
728 SB(t.m6(), 3, 4, to_underlying(st));
729 SB(t.m6(), 7, 1, 0);
730 t.m7() = 0;
731 t.m8() = 0;
732}
733
743 inline void MakeRailStation(Tile t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt)
744{
745 MakeStation(t, o, sid, StationType::Rail, section + a);
746 SetRailType(t, rt);
747 SetRailStationReservation(t, false);
748}
749
759 inline void MakeRailWaypoint(Tile t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt)
760{
761 MakeStation(t, o, sid, StationType::RailWaypoint, section + a);
762 SetRailType(t, rt);
763 SetRailStationReservation(t, false);
764}
765
776 inline void MakeRoadStop(Tile t, Owner o, StationID sid, RoadStopType rst, RoadType road_rt, RoadType tram_rt, DiagDirection d)
777{
778 MakeStation(t, o, sid, (rst == RoadStopType::Bus ? StationType::Bus : StationType::Truck), d);
779 SetRoadTypes(t, road_rt, tram_rt);
780 SetRoadOwner(t, RTT_ROAD, o);
781 SetRoadOwner(t, RTT_TRAM, o);
782}
783
796 inline void MakeDriveThroughRoadStop(Tile t, Owner station, Owner road, Owner tram, StationID sid, StationType rst, RoadType road_rt, RoadType tram_rt, Axis a)
797{
798 MakeStation(t, station, sid, rst, GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET + a);
799 SetRoadTypes(t, road_rt, tram_rt);
800 SetRoadOwner(t, RTT_ROAD, road);
801 SetRoadOwner(t, RTT_TRAM, tram);
802}
803
812 inline void MakeAirport(Tile t, Owner o, StationID sid, uint8_t section, WaterClass wc)
813{
814 MakeStation(t, o, sid, StationType::Airport, section, wc);
815}
816
823 inline void MakeBuoy(Tile t, StationID sid, WaterClass wc)
824{
825 /* Make the owner of the buoy tile the same as the current owner of the
826 * water tile. In this way, we can reset the owner of the water to its
827 * original state when the buoy gets removed. */
828 MakeStation(t, GetTileOwner(t), sid, StationType::Buoy, 0, wc);
829}
830
839 inline void MakeDock(Tile t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
840{
841 MakeStation(t, o, sid, StationType::Dock, d);
842 MakeStation(TileIndex(t) + TileOffsByDiagDir(d), o, sid, StationType::Dock, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
843}
844
851 inline void MakeOilrig(Tile t, StationID sid, WaterClass wc)
852{
853 MakeStation(t, OWNER_NONE, sid, StationType::Oilrig, 0, wc);
854}
855
856#endif /* STATION_MAP_H */
AssignBit
constexpr T AssignBit(T &x, const uint8_t y, bool value)
Assigns a bit in a variable.
Definition bitmath_func.hpp:176
SB
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
Definition bitmath_func.hpp:58
GB
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Definition bitmath_func.hpp:32
HasBit
constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition bitmath_func.hpp:103
ToggleBit
constexpr T ToggleBit(T &x, const uint8_t y)
Toggles a bit in a variable.
Definition bitmath_func.hpp:157
Tile
Wrapper class to abstract away the way the tiles are stored.
Definition map_func.h:25
Tile::m5
uint8_t & m5()
General purpose.
Definition map_func.h:161
Tile::m4
uint8_t & m4()
General purpose.
Definition map_func.h:149
Tile::m6
uint8_t & m6()
General purpose.
Definition map_func.h:173
Tile::m7
uint8_t & m7()
Primarily used for newgrf support.
Definition map_func.h:185
Tile::m3
uint8_t & m3()
General purpose.
Definition map_func.h:137
Tile::m8
uint16_t & m8()
General purpose.
Definition map_func.h:197
Tile::m2
uint16_t & m2()
Primarily used for indices to towns, industries and stations.
Definition map_func.h:125
OWNER_NONE
static constexpr Owner OWNER_NONE
The tile has no ownership.
Definition company_type.h:26
DiagDirToAxis
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
Definition direction_func.h:214
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition direction_type.h:123
AXIS_X
@ AXIS_X
The X axis.
Definition direction_type.h:124
AXIS_Y
@ AXIS_Y
The y axis.
Definition direction_type.h:125
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition direction_type.h:78
to_underlying
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
Definition enum_type.hpp:17
TileOffsByDiagDir
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Definition map_func.h:583
StationGfx
uint8_t StationGfx
Copy from station_map.h.
Definition newgrf_airport.h:23
rail.h
Rail specific functions.
IsCompatibleRail
bool IsCompatibleRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType can drive on a tile with a given RailType.
Definition rail.h:351
rail_map.h
Hides the direct accesses to the map array with map accessors.
GetRailType
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
Definition rail_map.h:115
SetRailType
void SetRailType(Tile t, RailType r)
Sets the rail type of the given tile.
Definition rail_map.h:125
RailType
RailType
Enumeration for all possible railtypes.
Definition rail_type.h:25
road.h
Road specific functions.
road_map.h
Map accessors for roads.
SetRoadOwner
void SetRoadOwner(Tile t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
Definition road_map.h:235
SetRoadTypes
void SetRoadTypes(Tile t, RoadType road_rt, RoadType tram_rt)
Set the present road types of a tile.
Definition road_map.h:604
Roadside
Roadside
The possible road side decorations.
Definition road_map.h:457
RTT_ROAD
@ RTT_ROAD
Road road type.
Definition road_type.h:38
RTT_TRAM
@ RTT_TRAM
Tram road type.
Definition road_type.h:39
RoadType
RoadType
The different roadtypes we support.
Definition road_type.h:23
station_func.h
Functions related to stations.
MakeAirport
void MakeAirport(Tile t, Owner o, StationID sid, uint8_t section, WaterClass wc)
Make the given tile an airport tile.
Definition station_map.h:812
GetStationType
StationType GetStationType(Tile t)
Get the station type of this tile.
Definition station_map.h:44
IsStationRoadStopTile
bool IsStationRoadStopTile(Tile t)
Is tile t a road stop station?
Definition station_map.h:234
GetStationGfx
StationGfx GetStationGfx(Tile t)
Get the station graphics of this tile.
Definition station_map.h:68
SetStationGfx
void SetStationGfx(Tile t, StationGfx gfx)
Set the station graphics of this tile.
Definition station_map.h:80
MakeRoadStop
void MakeRoadStop(Tile t, Owner o, StationID sid, RoadStopType rst, RoadType road_rt, RoadType tram_rt, DiagDirection d)
Make the given tile a roadstop tile.
Definition station_map.h:776
SetCustomStationSpecIndex
void SetCustomStationSpecIndex(Tile t, uint8_t specindex)
Set the custom station spec for this tile.
Definition station_map.h:630
GetRailStationTrackBits
TrackBits GetRailStationTrackBits(Tile t)
Get the trackbits of a rail station tile.
Definition station_map.h:526
SetStationTileHaveWires
void SetStationTileHaveWires(Tile t, bool b)
Set the catenary wires state of the rail station.
Definition station_map.h:467
IsAirportTile
bool IsAirportTile(Tile t)
Is this tile a station tile and an airport tile?
Definition station_map.h:167
IsAirport
bool IsAirport(Tile t)
Is this station tile an airport?
Definition station_map.h:157
IsBayRoadStopTile
bool IsBayRoadStopTile(Tile t)
Is tile t a bay (non-drive through) road stop station?
Definition station_map.h:266
IsRailWaypointTile
bool IsRailWaypointTile(Tile t)
Is this tile a station tile and a rail waypoint?
Definition station_map.h:123
GetTranslatedAirportTileID
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
Definition newgrf_airporttiles.cpp:98
GetCustomRoadStopSpecIndex
uint GetCustomRoadStopSpecIndex(Tile t)
Get the custom road stop spec for this tile.
Definition station_map.h:678
GFX_DOCK_BASE_WATER_PART
static const int GFX_DOCK_BASE_WATER_PART
The offset for the water parts.
Definition station_map.h:35
IsHangar
bool IsHangar(Tile t)
Check whether the given tile is a hangar.
Definition station_cmd.cpp:97
IsBuoy
bool IsBuoy(Tile t)
Is tile t a buoy tile?
Definition station_map.h:400
IsCompatibleTrainStationTile
bool IsCompatibleTrainStationTile(Tile test_tile, Tile station_tile)
Check if a tile is a valid continuation to a railstation tile.
Definition station_map.h:544
IsRoadWaypoint
bool IsRoadWaypoint(Tile t)
Is the station at t a road waypoint?
Definition station_map.h:202
MakeDriveThroughRoadStop
void MakeDriveThroughRoadStop(Tile t, Owner station, Owner road, Owner tram, StationID sid, StationType rst, RoadType road_rt, RoadType tram_rt, Axis a)
Make the given tile a drivethrough roadstop tile.
Definition station_map.h:796
IsDriveThroughStopTile
bool IsDriveThroughStopTile(Tile t)
Is tile t a drive through road stop station or waypoint?
Definition station_map.h:276
GetStationTileRandomBits
uint8_t GetStationTileRandomBits(Tile t)
Get the random bits of a station tile.
Definition station_map.h:702
GetRoadWaypointRoadside
static Roadside GetRoadWaypointRoadside(Tile tile)
Get the decorations of a road waypoint.
Definition station_map.h:288
IsRailStationTile
bool IsRailStationTile(Tile t)
Is this tile a station tile and a rail station?
Definition station_map.h:102
GetRailStationTrack
Track GetRailStationTrack(Tile t)
Get the rail track of a rail station tile.
Definition station_map.h:515
ToggleRoadWaypointOnSnowOrDesert
static void ToggleRoadWaypointOnSnowOrDesert(Tile t)
Toggle the snow/desert state of a road waypoint tile.
Definition station_map.h:320
GetStationIndex
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Definition station_map.h:28
HasStationTileRail
bool HasStationTileRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
Definition station_map.h:146
GetAirportGfx
StationGfx GetAirportGfx(Tile t)
Get the station graphics of this airport tile.
Definition station_map.h:332
CanStationTileHaveWires
bool CanStationTileHaveWires(Tile t)
Can tile t have catenary wires?
Definition station_map.h:455
GetCustomStationSpecIndex
uint GetCustomStationSpecIndex(Tile t)
Get the custom station spec for this tile.
Definition station_map.h:642
IsRailWaypoint
bool IsRailWaypoint(Tile t)
Is this station tile a rail waypoint?
Definition station_map.h:113
IsRailStation
bool IsRailStation(Tile t)
Is this station tile a rail station?
Definition station_map.h:92
IsHangarTile
bool IsHangarTile(Tile t)
Is tile t an hangar tile?
Definition station_map.h:420
IsDockTile
bool IsDockTile(Tile t)
Is tile t a dock tile?
Definition station_map.h:389
SetRoadWaypointRoadside
static void SetRoadWaypointRoadside(Tile tile, Roadside s)
Set the decorations of a road waypoint.
Definition station_map.h:299
MakeStation
void MakeStation(Tile t, Owner o, StationID sid, StationType st, uint8_t section, WaterClass wc=WaterClass::Invalid)
Make the given tile a station tile.
Definition station_map.h:717
SetStationTileRandomBits
void SetStationTileRandomBits(Tile t, uint8_t random_bits)
Set the random bits for a station tile.
Definition station_map.h:690
SetRailStationReservation
void SetRailStationReservation(Tile t, bool b)
Set the reservation state of the rail station.
Definition station_map.h:571
IsAnyRoadStop
bool IsAnyRoadStop(Tile t)
Is the station at t a road station?
Definition station_map.h:245
MakeOilrig
void MakeOilrig(Tile t, StationID sid, WaterClass wc)
Make the given tile an oilrig tile.
Definition station_map.h:851
GetDockDirection
DiagDirection GetDockDirection(Tile t)
Get the direction of a dock.
Definition station_map.h:595
GetRailStationAxis
Axis GetRailStationAxis(Tile t)
Get the rail direction of a rail station.
Definition station_map.h:503
IsRoadWaypointOnSnowOrDesert
static bool IsRoadWaypointOnSnowOrDesert(Tile t)
Check if a road waypoint tile has snow/desert.
Definition station_map.h:310
MakeRailWaypoint
void MakeRailWaypoint(Tile t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt)
Make the given tile a rail waypoint tile.
Definition station_map.h:759
IsRoadWaypointTile
bool IsRoadWaypointTile(Tile t)
Is this tile a station tile and a road waypoint?
Definition station_map.h:212
IsStationTileBlocked
bool IsStationTileBlocked(Tile t)
Is tile t a blocked tile?
Definition station_map.h:431
IsTruckStop
bool IsTruckStop(Tile t)
Is the station at t a truck stop?
Definition station_map.h:180
StationGfx
uint8_t StationGfx
Index of station graphics.
Definition station_map.h:20
IsStationRoadStop
bool IsStationRoadStop(Tile t)
Is the station at t a road station?
Definition station_map.h:223
IsBusStop
bool IsBusStop(Tile t)
Is the station at t a bus stop?
Definition station_map.h:191
IsCustomStationSpecIndex
bool IsCustomStationSpecIndex(Tile t)
Is there a custom rail station spec on this tile?
Definition station_map.h:618
HasStationRail
bool HasStationRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
Definition station_map.h:135
GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET
static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET
The offset for the drive through parts.
Definition station_map.h:36
GetDriveThroughStopAxis
Axis GetDriveThroughStopAxis(Tile t)
Gets the axis of the drive through stop.
Definition station_map.h:356
SetStationTileHavePylons
void SetStationTileHavePylons(Tile t, bool b)
Set the catenary pylon state of the rail station.
Definition station_map.h:491
CanStationTileHavePylons
bool CanStationTileHavePylons(Tile t)
Can tile t have catenary pylons?
Definition station_map.h:479
IsOilRig
bool IsOilRig(Tile t)
Is tile t part of an oilrig?
Definition station_map.h:368
IsBuoyTile
bool IsBuoyTile(Tile t)
Is tile t a buoy tile?
Definition station_map.h:410
IsDockWaterPart
bool IsDockWaterPart(Tile t)
Check whether a dock tile is the tile on water.
Definition station_map.h:605
MakeBuoy
void MakeBuoy(Tile t, StationID sid, WaterClass wc)
Make the given tile a buoy tile.
Definition station_map.h:823
MakeRailStation
void MakeRailStation(Tile t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt)
Make the given tile a rail station tile.
Definition station_map.h:743
HasStationReservation
bool HasStationReservation(Tile t)
Get the reservation state of the rail station.
Definition station_map.h:559
IsCustomRoadStopSpecIndex
bool IsCustomRoadStopSpecIndex(Tile t)
Is there a custom road stop spec on this tile?
Definition station_map.h:654
MakeDock
void MakeDock(Tile t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
Make the given tile a dock tile.
Definition station_map.h:839
GetBayRoadStopDir
DiagDirection GetBayRoadStopDir(Tile t)
Gets the direction the bay road stop entrance points towards.
Definition station_map.h:344
IsDock
bool IsDock(Tile t)
Is tile t a dock tile?
Definition station_map.h:379
IsAnyRoadStopTile
bool IsAnyRoadStopTile(Tile t)
Is tile t a road stop station?
Definition station_map.h:256
SetStationTileBlocked
void SetStationTileBlocked(Tile t, bool b)
Set the blocked state of the rail station.
Definition station_map.h:443
GetStationReservationTrackBits
TrackBits GetStationReservationTrackBits(Tile t)
Get the reserved track bits for a waypoint.
Definition station_map.h:583
GetRoadStopType
RoadStopType GetRoadStopType(Tile t)
Get the road stop type of this tile.
Definition station_map.h:56
SetCustomRoadStopSpecIndex
void SetCustomRoadStopSpecIndex(Tile t, uint8_t specindex)
Set the custom road stop spec for this tile.
Definition station_map.h:666
RoadStopType
RoadStopType
Types of RoadStops.
Definition station_type.h:43
RoadStopType::Bus
@ Bus
A standard stop for buses.
RoadStopType::Truck
@ Truck
A standard stop for trucks.
StationType
StationType
Station types.
Definition station_type.h:29
PoolID< uint16_t, struct StationIDTag, 64000, 0xFFFF >
IsTileType
static bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Definition tile_map.h:150
SetTileType
void SetTileType(Tile tile, TileType type)
Set the type of a tile.
Definition tile_map.h:131
GetTileOwner
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
Definition tile_map.h:178
SetTileOwner
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
Definition tile_map.h:198
TileIndex
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Definition tile_type.h:87
MP_STATION
@ MP_STATION
A tile of a station.
Definition tile_type.h:53
AxisToTrackBits
TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
Definition track_func.h:88
AxisToTrack
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:66
TrackBits
TrackBits
Allow incrementing of Track variables.
Definition track_type.h:35
TRACK_BIT_NONE
@ TRACK_BIT_NONE
No track.
Definition track_type.h:36
Track
Track
These are used to specify a single track.
Definition track_type.h:19
water_map.h
Map accessors for water tiles.
SetWaterClass
void SetWaterClass(Tile t, WaterClass wc)
Set the water class at a tile.
Definition water_map.h:126
WaterClass
WaterClass
classes of water (for WaterTileType::Clear water tile type).
Definition water_map.h:39
WaterClass::Invalid
@ Invalid
Used for industry tiles on land (also for oilrig if newgrf says so).
SetDockingTile
void SetDockingTile(Tile t, bool b)
Set the docking tile state of a tile.
Definition water_map.h:363