30 if (this->status.Test(RoadStopStatusFlag::BaseEntry)) {
34 if (CleaningPool())
return;
64 assert(this->
entries ==
nullptr);
82 if (north && rs_north->
entries !=
nullptr) {
86 if (south && rs_south->
entries !=
nullptr) {
98 if (rs_south->
entries ==
nullptr)
break;
103 }
else if (south && rs_south->
entries !=
nullptr) {
126 assert(this->
entries !=
nullptr);
144 DoClearSquare(this->
xy);
259 for (
RoadStop *rs = st->GetPrimaryRoadStop(type);; rs = rs->next) {
260 if (rs->xy == tile)
return rs;
261 assert(rs->next !=
nullptr);
314 default: NOT_REACHED();
328 if (side == -1) side = (&rs->
entries->
east ==
this);
331 std::vector<const RoadVehicle *> vehicles;
350 for (
const auto &it : vehicles) {
351 this->occupied += it->gcache.cached_total_length;
370 if (temp.
length != this->length || temp.
occupied != this->occupied) NOT_REACHED();
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.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Reset()
Reset all bits.
constexpr Timpl & Set()
Set all bits.
Iterate over all vehicles on a tile.
Some simple functions to help with accessing containers.
bool include(Container &container, typename Container::const_reference &item)
Helper function to append an item to a container if it is not already contained.
DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
Axis
Allow incrementing of DiagDirDiff variables.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
TileIndexDiff TileOffsByAxis(Axis axis)
Convert an Axis to a TileIndexDiff.
int32_t TileIndexDiff
An offset value between two tiles.
Some methods of Pool are placed here in order to reduce compilation time and binary size.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
bool HasTileAnyRoadType(Tile t, RoadTypes rts)
Check if a tile has one of the specified road types.
static DiagDirection GetEntryDirection(bool east, Axis axis)
Get the DiagDirection for entering the drive through stop from the given 'side' (east or west) on the...
RoadStopPool _roadstop_pool("RoadStop")
The pool of roadstops.
Base class for roadstops.
@ RVSB_IN_ROAD_STOP
The vehicle is in a road stop.
@ RVS_USING_SECOND_BAY
Only used while in a road stop.
@ RVS_IN_DT_ROAD_STOP
The vehicle is in a drive-through road stop.
@ RVS_IN_ROAD_STOP
The vehicle is in a road stop.
A number of safeguards to prevent using unsafe methods.
Base classes/functions for stations.
StationType GetStationType(Tile t)
Get the station type of this tile.
bool IsBayRoadStopTile(Tile t)
Is tile t a bay (non-drive through) road stop station?
bool IsDriveThroughStopTile(Tile t)
Is tile t a drive through road stop station or waypoint?
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Axis GetDriveThroughStopAxis(Tile t)
Gets the axis of the drive through stop.
RoadStopType GetRoadStopType(Tile t)
Get the road stop type of this tile.
RoadStopType
Types of RoadStops.
Definition of base types and functions in a cross-platform compatible way.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
uint16_t cached_total_length
Length of the whole vehicle (valid only for the first engine).
GroundVehicleCache gcache
Cache of often calculated values.
Base class for all pools.
Container for both east and west entry points.
Entry west
Information for vehicles that entered from the west.
Entry east
Information for vehicles that entered from the east.
Container for each entry point of a drive through road stop.
uint16_t occupied
The amount of occupied 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.
void Rebuild(const RoadStop *rs, int side=-1)
Rebuild, from scratch, the vehicles and other metadata on this stop.
uint16_t length
The length of the stop in tile 'units'.
A Stop for a Road Vehicle.
void SetEntranceBusy(bool busy)
Makes an entrance occupied or free.
@ BaseEntry
Non-zero when the entries on this road stop are the primary, i.e. the ones to delete.
void Leave(RoadVehicle *rv)
Leave the road stop.
RoadStop * next
Next stop of the given type at this station.
Entries * entries
Information about available and allocated bays.
uint AllocateBay()
Allocates a bay.
RoadStop * GetNextRoadStop(const struct RoadVehicle *v) const
Get the next road stop accessible by this vehicle.
bool HasFreeBay() const
Checks whether there is a free bay in this road stop.
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.
RoadStopStatusFlags status
Current status of the Stop. Access using *Bay and *Busy functions.
const Entry & GetEntry(DiagDirection dir) const
Get the drive through road stop entry struct for the given direction.
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 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...
void ClearDriveThrough()
Prepare for removal of this stop; update other neighbouring stops if needed.
Buses, trucks and trams belong to this class.
RoadTypes compatible_roadtypes
NOSAVE: Roadtypes this consist is powered on.
static T * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
Direction direction
facing
bool HasArticulatedPart() const
Check if an engine has an articulated part.
TileIndex tile
Current tile index.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
static const uint TILE_SIZE
Tile size in world coordinates.
@ MP_STATION
A tile of a station.
@ Crashed
Vehicle is crashed.
Functions related to vehicles.
@ VEH_ROAD
Road vehicle type.