RoadStop Struct Reference

A Stop for a Road Vehicle. More...

#include <station_base.h>

Inheritance diagram for RoadStop:

PoolItem< T, Tid, Tpool >

Public Member Functions

 RoadStop (TileIndex tile=INVALID_TILE)
 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.
RoadStopGetNextRoadStop (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 RoadStopnext
 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.
static const uint MAX_VEHICLES = 64
 The maximum number of vehicles that can allocate a slot to this roadstop.

Detailed Description

A Stop for a Road Vehicle.

Definition at line 51 of file station_base.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 448 of file station.cpp.

References cDebugCtorLevel, PoolItem< T, Tid, Tpool >::CleaningPool(), INVALID_TILE, 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 69 of file station_base.h.

References INVALID_TILE, and xy.

uint RoadStop::AllocateBay (  ) 

Allocates a bay.

Returns:
the allocated bay number
Precondition:
this->HasFreeBay()

Definition at line 485 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 501 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 511 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 535 of file station.cpp.

References next, and ROADTYPES_NONE.


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

Generated on Thu Sep 24 19:35:35 2009 for OpenTTD by  doxygen 1.5.6