|
OpenTTD
|
A Stop for a Road Vehicle. More...
#include <roadstop_base.h>
Data Structures | |
| struct | Entry |
| Container for each entry point of a drive through road stop. More... | |
Public Types | |
| enum | RoadStopStatusFlags { RSSFB_BAY0_FREE = 0, RSSFB_BAY1_FREE = 1, RSSFB_BAY_COUNT = 2, RSSFB_BASE_ENTRY = 6, RSSFB_ENTRY_BUSY = 7 } |
Public Member Functions | |
| RoadStop (TileIndex tile=INVALID_TILE) | |
| Initializes a RoadStop. | |
| ~RoadStop () | |
| De-Initializes RoadStops. | |
| bool | HasFreeBay () const |
| Checks whether there is a free bay in this road stop. More... | |
| bool | IsFreeBay (uint nr) const |
| Checks whether the given bay is free in this road stop. More... | |
| bool | IsEntranceBusy () const |
| Checks whether the entrance of the road stop is occupied by a vehicle. More... | |
| void | SetEntranceBusy (bool busy) |
| Makes an entrance occupied or free. More... | |
| const Entry * | GetEntry (DiagDirection dir) const |
| Get the drive through road stop entry struct for the given direction. More... | |
| Entry * | GetEntry (DiagDirection dir) |
| Get the drive through road stop entry struct for the given direction. More... | |
| void | MakeDriveThrough () |
| Join this road stop to another 'base' road stop if possible; fill all necessary data to become an actual drive through road stop. More... | |
| void | ClearDriveThrough () |
| Prepare for removal of this stop; update other neighbouring stops if needed. More... | |
| void | Leave (RoadVehicle *rv) |
| Leave the road stop. More... | |
| bool | Enter (RoadVehicle *rv) |
| Enter the road stop. More... | |
| RoadStop * | GetNextRoadStop (const struct RoadVehicle *v) const |
| Get the next road stop accessible by this vehicle. More... | |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_roadstop_pool > | |
| void * | operator new (size_t size) |
| Allocates space for new Titem. More... | |
| void * | operator new (size_t size, size_t index) |
| Allocates space for new Titem with given index. More... | |
| void * | operator new (size_t size, void *ptr) |
| Allocates space for new Titem at given memory address. More... | |
| void | operator delete (void *p) |
| Marks Titem as free. More... | |
Static Public Member Functions | |
| static RoadStop * | GetByTile (TileIndex tile, RoadStopType type) |
| Find a roadstop at given tile. More... | |
| 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 direction for the same vehicle. More... | |
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_roadstop_pool > | |
| static bool | CanAllocateItem (size_t n=1) |
| Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() More... | |
| static bool | CleaningPool () |
| Returns current state of pool cleaning - yes or no. More... | |
| static bool | IsValidID (size_t index) |
| Tests whether given index can be used to get valid (non-NULL) Titem. More... | |
| static Titem * | Get (size_t index) |
| Returns Titem with given index. More... | |
| static Titem * | GetIfValid (size_t index) |
| Returns Titem with given index. More... | |
| static size_t | GetPoolSize () |
| Returns first unused index. More... | |
| static size_t | GetNumItems () |
| Returns number of valid items in the pool. More... | |
| static void | PostDestructor (size_t index) |
| Dummy function called after destructor of each member. More... | |
Data Fields | |
| TileIndex | xy |
| Position on the map. | |
| byte | status |
| Current status of the Stop,. More... | |
| struct RoadStop * | next |
| Next stop of the given type at this station. | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_roadstop_pool > | |
| Tindex | index |
| Index of this pool item. | |
Private Member Functions | |
| uint | AllocateBay () |
| Allocates a bay. More... | |
| void | AllocateDriveThroughBay (uint nr) |
| Allocates a bay in a drive-through road stop. More... | |
| void | FreeBay (uint nr) |
| Frees the given bay. More... | |
Private Attributes | |
| Entry * | east |
| The vehicles that entered from the east. | |
| Entry * | west |
| The vehicles that entered from the west. | |
A Stop for a Road Vehicle.
Definition at line 24 of file roadstop_base.h.
Definition at line 25 of file roadstop_base.h.
|
inlineprivate |
Allocates a bay.
Definition at line 160 of file roadstop_base.h.
Referenced by Enter().
|
inlineprivate |
Allocates a bay in a drive-through road stop.
| nr | the number of the bay to allocate |
Definition at line 176 of file roadstop_base.h.
| void RoadStop::ClearDriveThrough | ( | ) |
Prepare for removal of this stop; update other neighbouring stops if needed.
Also update the length etc.
Definition at line 132 of file roadstop.cpp.
Referenced by GetEntry().
| bool RoadStop::Enter | ( | RoadVehicle * | rv | ) |
Enter the road stop.
| rv | the vehicle that enters the stop |
Definition at line 235 of file roadstop.cpp.
References AllocateBay(), Vehicle::direction, DirToDiagDir(), RoadStop::Entry::Enter(), GetEntry(), Vehicle::HasArticulatedPart(), HasFreeBay(), IsEntranceBusy(), IsStandardRoadStopTile(), RVS_IN_DT_ROAD_STOP, RVS_IN_ROAD_STOP, RVS_USING_SECOND_BAY, SB(), SetBit(), SetEntranceBusy(), RoadVehicle::state, and xy.
|
inlineprivate |
Frees the given bay.
| nr | the number of the bay to free |
Definition at line 186 of file roadstop_base.h.
Referenced by Leave().
|
static |
Find a roadstop at given tile.
| tile | tile with roadstop |
| type | roadstop type |
Definition at line 268 of file roadstop.cpp.
References SpecializedStation< Station, false >::GetByTile(), and next.
Referenced by GetEntry(), CYapfCostRoadT< Types >::OneTileCost(), RemoveRoadStop(), and RoadFindPathToDest().
|
inline |
Get the drive through road stop entry struct for the given direction.
| dir | The direction to get the entry for. |
Definition at line 124 of file roadstop_base.h.
References east, HasBit(), and west.
Referenced by Enter(), Leave(), and CYapfCostRoadT< Types >::OneTileCost().
|
inline |
Get the drive through road stop entry struct for the given direction.
| dir | The direction to get the entry for. |
Definition at line 134 of file roadstop_base.h.
References ClearDriveThrough(), east, RoadStop::Entry::Enter(), GetByTile(), GetNextRoadStop(), HasBit(), IsDriveThroughRoadStopContinuation(), RoadStop::Entry::Leave(), MakeDriveThrough(), and west.
| RoadStop * RoadStop::GetNextRoadStop | ( | const struct RoadVehicle * | v | ) | const |
Get the next road stop accessible by this vehicle.
| v | the vehicle to get the next road stop for. |
Definition at line 44 of file roadstop.cpp.
References GetRoadTypes(), Vehicle::HasArticulatedPart(), IsStandardRoadStopTile(), next, and ROADTYPES_NONE.
Referenced by GetEntry().
|
inline |
Checks whether there is a free bay in this road stop.
Definition at line 85 of file roadstop_base.h.
References GB(), and RSSFB_BAY_COUNT.
Referenced by Enter().
Checks whether the 'next' tile is still part of the road same drive through stop 'rs' in the same direction for the same vehicle.
| rs | the road stop tile to check against |
| next | the 'next' tile to check |
Definition at line 307 of file roadstop.cpp.
References GetRoadStopDir(), GetStationIndex(), GetStationType(), IsDriveThroughStopTile(), IsTileType(), and MP_STATION.
Referenced by GetEntry(), and CYapfCostRoadT< Types >::OneTileCost().
|
inline |
Checks whether the entrance of the road stop is occupied by a vehicle.
Definition at line 105 of file roadstop_base.h.
References HasBit(), and RSSFB_ENTRY_BUSY.
Referenced by Enter().
|
inline |
Checks whether the given bay is free in this road stop.
| nr | bay to check |
Definition at line 95 of file roadstop_base.h.
Referenced by CYapfCostRoadT< Types >::OneTileCost().
| void RoadStop::Leave | ( | RoadVehicle * | rv | ) |
Leave the road stop.
| rv | the vehicle that leaves the stop |
Definition at line 218 of file roadstop.cpp.
References Vehicle::direction, DirToDiagDir(), FreeBay(), GetEntry(), HasBit(), IsStandardRoadStopTile(), RoadStop::Entry::Leave(), RVS_USING_SECOND_BAY, SetEntranceBusy(), RoadVehicle::state, and Vehicle::tile.
| void RoadStop::MakeDriveThrough | ( | ) |
Join this road stop to another 'base' road stop if possible; fill all necessary data to become an actual drive through road stop.
Also update the length etc.
Definition at line 64 of file roadstop.cpp.
Referenced by GetEntry().
|
inline |
Makes an entrance occupied or free.
| busy | If true, marks busy; free otherwise. |
Definition at line 114 of file roadstop_base.h.
References RSSFB_ENTRY_BUSY, and SB().
| byte RoadStop::status |
Current status of the Stop,.
Definition at line 70 of file roadstop_base.h.
Referenced by RoadStop::Entry::CheckIntegrity().
1.8.13