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