OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
29 if (
HasBit(this->status, RSSFB_BASE_ENTRY)) {
34 if (CleaningPool())
return;
64 assert(this->
east ==
nullptr && this->
west ==
nullptr);
83 if (north && rs_north->
east !=
nullptr) {
88 if (south && rs_south->
east !=
nullptr) {
95 delete rs_south->
east;
96 delete rs_south->
west;
101 if (rs_south->
east ==
nullptr)
break;
107 }
else if (south && rs_south->
east !=
nullptr) {
132 assert(this->
east !=
nullptr && this->
west !=
nullptr);
151 DoClearSquare(this->
xy);
169 rs_south->
east = rs_south_base->
east;
170 rs_south->
west = rs_south_base->
west;
208 this->
east =
nullptr;
209 this->
west =
nullptr;
270 for (
RoadStop *rs = st->GetPrimaryRoadStop(type);; rs = rs->
next) {
271 if (rs->xy == tile)
return rs;
272 assert(rs->next !=
nullptr);
314 typedef std::list<const RoadVehicle *>
RVList;
339 for (
const auto &it : rserh->
vehicles) {
340 if (rv == it)
return nullptr;
357 if (side == -1) side = (rs->
east ==
this);
370 for (
const auto &it : rserh.
vehicles) {
371 this->occupied += it->gcache.cached_total_length;
389 if (temp.
length != this->length || temp.
occupied != this->occupied) NOT_REACHED();
Buses, trucks and trams belong to this class.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
DiagDirection dir
The direction the vehicle has to face to be added.
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.
TileIndex xy
Position on the map.
@ RVSB_IN_ROAD_STOP
The vehicle is in a road stop.
static RoadStop * GetByTile(TileIndex tile, RoadStopType type)
Find a roadstop at given tile.
@ VEH_ROAD
Road vehicle type.
static const uint TILE_SIZE
Tile size in world coordinates.
DiagDirection
Enumeration for diagonal directions.
const Entry * GetEntry(DiagDirection dir) const
Get the drive through road stop entry struct for the given direction.
DiagDirection GetRoadStopDir(Tile t)
Gets the direction the road stop entrance points towards.
RoadStopPool _roadstop_pool("RoadStop")
The pool of roadstops.
bool Enter(RoadVehicle *rv)
Enter the road stop.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
@ RVS_USING_SECOND_BAY
Only used while in a road stop.
std::list< const RoadVehicle * > RVList
A list of road vehicles.
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'.
bool IsBayRoadStopTile(Tile t)
Is tile t a bay (non-drive through) road stop station?
TileIndex tile
Current tile index.
@ VS_CRASHED
Vehicle is crashed.
RVList vehicles
The list of vehicles to possibly add to.
void FreeBay(uint nr)
Frees the given bay.
DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
GroundVehicleCache gcache
Cache of often calculated values.
DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
@ RVS_IN_ROAD_STOP
The vehicle is in a road stop.
RoadTypes compatible_roadtypes
NOSAVE: Roadtypes this consist is powered on.
int32_t TileIndexDiff
An offset value between two tiles.
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,.
StationType GetStationType(Tile t)
Get the station type of this tile.
Helper for finding RVs in a road stop.
Direction direction
facing
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
void Leave(const RoadVehicle *rv)
Leave the road stop.
Base class for all pools.
void ClearDriveThrough()
Prepare for removal of this stop; update other neighbouring stops if needed.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
constexpr T abs(const T a)
Returns the absolute value of (scalar) variable.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
Vehicle * FindVehiclesInRoadStop(Vehicle *v, void *data)
Add road vehicles to the station's list if needed.
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...
@ MP_STATION
A tile of a station.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
bool HasArticulatedPart() const
Check if an engine has an articulated part.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
RoadStop * next
Next stop of the given type at this station.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
RoadStopType GetRoadStopType(Tile t)
Get the road stop type of this tile.
RoadStopType
Types of RoadStops.
@ RVS_IN_DT_ROAD_STOP
The vehicle is in a drive-through road stop.
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.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
A Stop for a Road Vehicle.
VehicleType type
Type of vehicle.
bool HasTileAnyRoadType(Tile t, RoadTypes rts)
Check if a tile has one of the specified road types.
Container for each entry point of a drive through road stop.
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
uint16_t cached_total_length
Length of the whole vehicle (valid only for the first engine).
RoadStop * GetNextRoadStop(const struct RoadVehicle *v) const
Get the next road stop accessible by this vehicle.
bool IsDriveThroughStopTile(Tile t)
Is tile t a drive through road stop station or waypoint?
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.