31 if (
HasBit(this->status, RSSFB_BASE_ENTRY)) {
36 if (CleaningPool())
return;
66 assert(this->
east == NULL && this->
west == NULL);
85 if (north && rs_north->
east != NULL) {
90 if (south && rs_south->
east != NULL) {
97 delete rs_south->
east;
98 delete rs_south->
west;
103 if (rs_south->
east == NULL)
break;
109 }
else if (south && rs_south->
east != NULL) {
134 assert(this->
east != NULL && this->
west != NULL);
153 DoClearSquare(this->
xy);
171 rs_south->
east = rs_south_base->
east;
172 rs_south->
west = rs_south_base->
west;
272 for (
RoadStop *rs = st->GetPrimaryRoadStop(type);; rs = rs->
next) {
273 if (rs->xy == tile)
return rs;
274 assert(rs->next != NULL);
285 assert(this->occupied >= 0);
316 typedef std::list<const RoadVehicle *>
RVList;
341 for (RVList::iterator it = rserh->
vehicles.begin(); it != rserh->
vehicles.end(); it++) {
342 if (rv == *it)
return NULL;
359 if (side == -1) side = (rs->
east ==
this);
372 for (RVList::iterator it = rserh.
vehicles.begin(); it != rserh.
vehicles.end(); it++) {
373 this->occupied += (*it)->gcache.cached_total_length;
391 if (temp.
length != this->length || temp.
occupied != this->occupied) NOT_REACHED();
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.
static DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
DirectionByte direction
facing
Base class for roadstops.
static RoadStopType GetRoadStopType(TileIndex t)
Get the road stop type of this tile.
int32 TileIndexDiff
An offset value between to tiles.
The vehicle is in a drive-through road stop.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
void Leave(RoadVehicle *rv)
Leave the road 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...
Functions related to vehicles.
void FreeBay(uint nr)
Frees the given bay.
void Enter(const RoadVehicle *rv)
Enter the road stop.
static bool IsStandardRoadStopTile(TileIndex t)
Is tile t a standard (non-drive through) road stop station?
static bool IsDriveThroughStopTile(TileIndex t)
Is tile t a drive through road stop station?
RoadStop * GetNextRoadStop(const struct RoadVehicle *v) const
Get the next road stop accessible by this vehicle.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
static StationType GetStationType(TileIndex t)
Get the station type of this tile.
static const uint TILE_SIZE
Tile size in world coordinates.
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.
Buses, trucks and trams belong to this class.
Helper for finding RVs in a road stop.
Some methods of Pool are placed here in order to reduce compilation time and binary size...
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a give tiletype.
The vehicle is in a road stop.
void ClearDriveThrough()
Prepare for removal of this stop; update other neighbouring stops if needed.
RVList vehicles
The list of vehicles to possibly add to.
static DiagDirection GetRoadStopDir(TileIndex t)
Gets the direction the road stop entrance points towards.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
void CheckIntegrity(const RoadStop *rs) const
Check the integrity of the data in this struct.
Definition of base types and functions in a cross-platform compatible way.
Entry * east
The vehicles that entered from the east.
void SetEntranceBusy(bool busy)
Makes an entrance occupied or free.
A number of safeguards to prevent using unsafe methods.
struct RoadStop * next
Next stop of the given type at this station.
Only used while in a road stop.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
TileIndex tile
Current tile index.
bool HasArticulatedPart() const
Check if an engine has an articulated part.
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 pools.
Container for each entry point of a drive through road stop.
bool Enter(RoadVehicle *rv)
Enter the road stop.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
bool HasFreeBay() const
Checks whether there is a free bay in this road stop.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
uint32 TileIndex
The index/ID of a Tile.
static T abs(const T a)
Returns the absolute value of (scalar) variable.
uint16 cached_total_length
Length of the whole vehicle (valid only for the first engine).
int occupied
The amount of occupied stop in tile 'units'.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Vehicle * FindVehiclesInRoadStop(Vehicle *v, void *data)
Add road vehicles to the station's list if needed.
const Entry * GetEntry(DiagDirection dir) const
Get the drive through road stop entry struct for the given direction.
The vehicle is in a road stop.
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...
std::list< const RoadVehicle * > RVList
A list of road vehicles.
static RoadTypes GetRoadTypes(TileIndex t)
Get the present road types of a tile.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
void Leave(const RoadVehicle *rv)
Leave the road stop.
Non-zero when the entries on this road stop are the primary, i.e. the ones to delete.
RoadStopPool _roadstop_pool("RoadStop")
The pool of roadstops.
DiagDirection dir
The direction the vehicle has to face to be added.
Base classes/functions for stations.
void Rebuild(const RoadStop *rs, int side=-1)
Rebuild, from scratch, the vehicles and other metadata on this stop.
VehicleTypeByte type
Type of vehicle.
static RoadStop * GetByTile(TileIndex tile, RoadStopType type)
Find a roadstop at given tile.
GroundVehicleCache gcache
Cache of often calculated values.