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