OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
10 #ifndef ROADSTOP_BASE_H
11 #define ROADSTOP_BASE_H
96 return HasBit(this->status, nr);
164 while (!
HasBit(this->status, bay_nr)) bay_nr++;
166 ClrBit(this->status, bay_nr);
Buses, trucks and trams belong to this class.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
bool HasFreeBay() const
Checks whether there is a free bay in this road stop.
void CheckIntegrity(const RoadStop *rs) const
Check the integrity of the data in this struct.
bool IsEntranceBusy() const
Checks whether the entrance of the road stop is occupied by a vehicle.
int GetOccupied() const
Get the amount of occupied space in this drive through stop.
TileIndex xy
Position on the map.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
static RoadStop * GetByTile(TileIndex tile, RoadStopType type)
Find a roadstop at given tile.
DiagDirection
Enumeration for diagonal directions.
const Entry * GetEntry(DiagDirection dir) const
Get the drive through road stop entry struct for the given direction.
bool Enter(RoadVehicle *rv)
Enter the road stop.
int length
The length of the stop in tile 'units'.
void Enter(const RoadVehicle *rv)
Enter the road stop.
void Rebuild(const RoadStop *rs, int side=-1)
Rebuild, from scratch, the vehicles and other metadata on this stop.
void MakeDriveThrough()
Join this road stop to another 'base' road stop if possible; fill all necessary data to become an act...
@ RSSFB_BASE_ENTRY
Non-zero when the entries on this road stop are the primary, i.e. the ones to delete.
Entry * west
The vehicles that entered from the west.
uint AllocateBay()
Allocates a bay.
int occupied
The amount of occupied stop in tile 'units'.
@ RSSFB_ENTRY_BUSY
Non-zero when roadstop entry is busy.
void FreeBay(uint nr)
Frees the given bay.
~RoadStop()
De-Initializes RoadStops.
@ RSSFB_BAY_COUNT
Max. number of bays.
void AllocateDriveThroughBay(uint nr)
Allocates a bay in a drive-through road stop.
Entry * east
The vehicles that entered from the east.
void SetEntranceBusy(bool busy)
Makes an entrance occupied or free.
void Leave(RoadVehicle *rv)
Leave the road stop.
uint8_t status
Current status of the Stop,.
@ RSSFB_BAY1_FREE
Non-zero when bay 1 is free.
void Leave(const RoadVehicle *rv)
Leave the road stop.
RoadStop(TileIndex tile=INVALID_TILE)
Initializes a RoadStop.
Base class for all pools.
void ClearDriveThrough()
Prepare for removal of this stop; update other neighbouring stops if needed.
@ RSSFB_BAY0_FREE
Non-zero when bay 0 is free.
static bool IsDriveThroughRoadStopContinuation(TileIndex rs, TileIndex next)
Checks whether the 'next' tile is still part of the road same drive through stop 'rs' in the same dir...
int GetLength() const
Get the length of this drive through stop.
RoadStop * next
Next stop of the given type at this station.
RoadStopPool _roadstop_pool
The pool of roadstops.
bool IsFreeBay(uint nr) const
Checks whether the given bay is free in this road stop.
RoadStopType
Types of RoadStops.
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.
A Stop for a Road Vehicle.
Container for each entry point of a drive through road stop.
Entry * GetEntry(DiagDirection dir)
Get the drive through road stop entry struct for the given direction.
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
Base class for all PoolItems.
RoadStop * GetNextRoadStop(const struct RoadVehicle *v) const
Get the next road stop accessible by this vehicle.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.