# RoadStop Struct Reference

A Stop for a Road Vehicle. More...

`#include <station.h>`

Inheritance diagram for RoadStop:

## Public Types
enum | Type { BUS, TRUCK }
| Types of RoadStops. More...
## Public Member Functions
| RoadStop (TileIndex tile=0)
| Initializes a RoadStop.
virtual | ~RoadStop ()
| De-Initializes a RoadStops.
bool | IsValid () const
| Determines whether a road stop exists.
bool | HasFreeBay () const
| Checks whether there is a free bay in this road stop.
bool | IsFreeBay (uint nr) const
| Checks whether the given bay is free in this road stop.
uint | AllocateBay ()
| Allocates a bay.
void | AllocateDriveThroughBay (uint nr)
| Allocates a bay in a drive-through road stop.
void | FreeBay (uint nr)
| Frees the given bay.
bool | IsEntranceBusy () const
| Checks whether the entrance of the road stop is occupied by a vehicle.
void | SetEntranceBusy (bool busy)
| Makes an entrance occupied or free.
RoadStop * | GetNextRoadStop (const Vehicle *v) const
| Get the next road stop accessible by this vehicle.
## Data Fields
TileIndex | xy
| Position on the map.
byte | status
| Current status of the Stop. Like which spot is taken. Access using *Bay and *Busy functions.
byte | num_vehicles
| Number of vehicles currently slotted to this stop.
struct RoadStop * | next
| Next stop of the given type at this station.
## Static Public Attributes
static const int | cDebugCtorLevel = 5
| Debug level on which Contructor / Destructor messages are printed.
static const uint | LIMIT = 16
| The maximum amount of roadstops that are allowed at a single station.
static const uint | MAX_BAY_COUNT = 2
| The maximum number of loading bays.

## Detailed Description

A Stop for a Road Vehicle.

Definition at line 51 of file station.h.

## Member Enumeration Documentation

enum RoadStop::Type

Types of RoadStops.

Enumerator:

  BUS | A standard stop for buses.
  TRUCK | A standard stop for trucks.

Definition at line 53 of file station.h.

## Constructor & Destructor Documentation

RoadStop::~RoadStop | ( |  | ) | `[virtual]`

De-Initializes a RoadStops.

This includes clearing all slots that vehicles might have and unlinks it from the linked list of road stops at the given station

Definition at line 419 of file station.cpp.

References cDebugCtorLevel, PoolItem< T, Tid, Tpool >::CleaningPool(), num_vehicles, and xy.

## Member Function Documentation

bool RoadStop::IsValid | ( |  | ) | const`[inline]`

Determines whether a road stop exists.

Returns:
  true if and only is the road stop exists

Definition at line 74 of file station.h.

References xy.

uint RoadStop::AllocateBay | ( |  | ) |

Allocates a bay.

Returns:
  the allocated bay number

Precondition:
  this->HasFreeBay()

Definition at line 456 of file station.cpp.

References ClrBit(), HasBit(), HasFreeBay(), and status.

void RoadStop::AllocateDriveThroughBay | ( | uint | nr | ) |

Allocates a bay in a drive-through road stop.

Parameters:

  | nr | the number of the bay to allocate

Definition at line 472 of file station.cpp.

References ClrBit(), MAX_BAY_COUNT, and status.

void RoadStop::FreeBay | ( | uint | nr | ) |

Frees the given bay.

Parameters:

  | nr | the number of the bay to free

Definition at line 482 of file station.cpp.

References MAX_BAY_COUNT, SetBit(), and status.

RoadStop * RoadStop::GetNextRoadStop | ( | const Vehicle * | v | ) | const

Get the next road stop accessible by this vehicle.

Parameters:

  | v | the vehicle to get the next road stop for.

Returns:
  the next road stop accessible.

Definition at line 506 of file station.cpp.

References next, ROADTYPES_NONE, and xy.

The documentation for this struct was generated from the following files:

- src/station.h
- src/station.cpp