OpenTTD Source
1.11.0-beta2
|
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 (RVList::iterator it = rserh->
vehicles.begin(); it != rserh->
vehicles.end(); it++) {
340 if (rv == *it)
return nullptr;
357 if (side == -1) side = (rs->
east ==
this);
370 for (RVList::iterator it = rserh.
vehicles.begin(); it != rserh.
vehicles.end(); it++) {
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.
uint32 TileIndex
The index/ID of a Tile.
static bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
Check if a tile has one of the specified road types.
DiagDirection dir
The direction the vehicle has to face to be added.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
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 bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
static RoadStopType GetRoadStopType(TileIndex t)
Get the road stop type of this tile.
static bool IsStandardRoadStopTile(TileIndex t)
Is tile t a standard (non-drive through) road stop station?
static RoadStop * GetByTile(TileIndex tile, RoadStopType type)
Find a roadstop at given tile.
static bool IsDriveThroughStopTile(TileIndex t)
Is tile t a drive through road stop station?
static const uint TILE_SIZE
Tile size in world coordinates.
const Entry * GetEntry(DiagDirection dir) const
Get the drive through road stop entry struct for the given direction.
RoadStopPool _roadstop_pool("RoadStop")
The pool of roadstops.
bool Enter(RoadVehicle *rv)
Enter the road stop.
@ VEH_ROAD
Road vehicle type.
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.
struct RoadStop * next
Next stop of the given type at this station.
int occupied
The amount of occupied stop in tile 'units'.
uint16 cached_total_length
Length of the whole vehicle (valid only for the first engine).
static DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
int32 TileIndexDiff
An offset value between to tiles.
TileIndex tile
Current tile index.
@ VS_CRASHED
Vehicle is crashed.
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.
RVList vehicles
The list of vehicles to possibly add to.
void FreeBay(uint nr)
Frees the given bay.
static StationType GetStationType(TileIndex t)
Get the station type of this tile.
GroundVehicleCache gcache
Cache of often calculated values.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
@ RVS_IN_ROAD_STOP
The vehicle is in a road stop.
RoadTypes compatible_roadtypes
Roadtypes this consist is powered on.
static DiagDirection GetRoadStopDir(TileIndex t)
Gets the direction the road stop entrance points towards.
DiagDirection
Enumeration for diagonal directions.
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.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Helper for finding RVs in a road stop.
Direction direction
facing
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.
RoadStopType
Types of RoadStops.
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 StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
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.
byte status
Current status of the Stop,.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
static T abs(const T a)
Returns the absolute value of (scalar) variable.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
@ RVS_IN_DT_ROAD_STOP
The vehicle is in a drive-through road stop.
A Stop for a Road Vehicle.
VehicleType type
Type of vehicle.
Container for each entry point of a drive through road stop.
RoadStop * GetNextRoadStop(const struct RoadVehicle *v) const
Get the next road stop accessible by this vehicle.