29 if (
HasBit(this->status, RSSFB_BASE_ENTRY)) {
34 if (CleaningPool())
return;
64 assert(this->
east ==
nullptr && this->
west ==
nullptr);
82 if (north && rs_north->
east !=
nullptr) {
87 if (south && rs_south->
east !=
nullptr) {
94 delete rs_south->
east;
95 delete rs_south->
west;
100 if (rs_south->
east ==
nullptr)
break;
106 }
else if (south && rs_south->
east !=
nullptr) {
131 assert(this->
east !=
nullptr && this->
west !=
nullptr);
149 DoClearSquare(this->
xy);
167 rs_south->
east = rs_south_base->
east;
168 rs_south->
west = rs_south_base->
west;
206 this->
east =
nullptr;
207 this->
west =
nullptr;
268 for (
RoadStop *rs = st->GetPrimaryRoadStop(type);; rs = rs->
next) {
269 if (rs->xy == tile)
return rs;
270 assert(rs->next !=
nullptr);
312 typedef std::list<const RoadVehicle *>
RVList;
337 for (
const auto &it : rserh->
vehicles) {
338 if (rv == it)
return nullptr;
356 default: NOT_REACHED();
381 for (
const auto &it : rserh.
vehicles) {
382 this->occupied += it->gcache.cached_total_length;
401 if (temp.
length != this->length || temp.
occupied != this->occupied) NOT_REACHED();
constexpr debug_inline 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 T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
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...
std::list< const RoadVehicle * > RVList
A list of road vehicles.
RoadStopPool _roadstop_pool("RoadStop")
The pool of roadstops.
Vehicle * FindVehiclesInRoadStop(Vehicle *v, void *data)
Add road vehicles to the station's list if needed.
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.
VehicleType type
Type of vehicle.
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.
Helper for finding RVs in a road stop.
RVList vehicles
The list of vehicles to possibly add to.
DiagDirection dir
The direction the vehicle has to face to be added.
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 Rebuild(const RoadStop *rs)
Rebuild, from scratch, the vehicles and other metadata on this stop.
void CheckIntegrity(const RoadStop *rs) const
Check the integrity of the data in this struct.
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.
const Entry * GetEntry(DiagDirection dir) const
Get the drive through road stop entry struct for the given direction.
@ RSSFB_BASE_ENTRY
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.
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.
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.
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 Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
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.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
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.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
@ VS_CRASHED
Vehicle is crashed.
Functions related to vehicles.
@ VEH_ROAD
Road vehicle type.