OpenTTD Source: CYapfCostRoadT< Types > Class Template Reference

OpenTTD Source 15.0-RC2

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
CYapfCostRoadT< Types > Class Template Reference

## Public Types
typedef Types::Tpf | Tpf
| pathfinder (derived from THIS class)
typedef Types::TrackFollower | TrackFollower
| track follower helper
typedef Types::NodeList::Item | Node
| this will be our node type
typedef Node::Key | Key
| key to hash tables

## Public Member Functions
void | SetMaxCost (int max_cost)
bool | PfCalcCost (Node &n, const TrackFollower *)
| Called by YAPF to calculate the cost from the origin to the given node.

## Protected Member Functions
Tpf & | Yapf ()
| to access inherited path finder
int | SlopeCost (TileIndex tile, TileIndex next_tile, Trackdir)
int | OneTileCost (TileIndex tile, Trackdir trackdir)
| return one tile cost

## Protected Attributes
int | max_cost

## Detailed Description

template<class Types>
class CYapfCostRoadT< Types >

Definition at line 19 of file yapf_road.cpp.

## Member Typedef Documentation

## ◆ Key

template<class Types >

typedef Node::Key CYapfCostRoadT< Types >::Key

key to hash tables

Definition at line 24 of file yapf_road.cpp.

## ◆ Node

template<class Types >

typedef Types::NodeList::Item CYapfCostRoadT< Types >::Node

this will be our node type

Definition at line 23 of file yapf_road.cpp.

## ◆ Tpf

template<class Types >

typedef Types::Tpf CYapfCostRoadT< Types >::Tpf

pathfinder (derived from THIS class)

Definition at line 21 of file yapf_road.cpp.

## ◆ TrackFollower

template<class Types >

typedef Types::TrackFollower CYapfCostRoadT< Types >::TrackFollower

track follower helper

Definition at line 22 of file yapf_road.cpp.

## Constructor & Destructor Documentation

## ◆ CYapfCostRoadT()

template<class Types >

CYapfCostRoadT< Types >::CYapfCostRoadT | ( |  | ) |
| inlineprotected

Definition at line 29 of file yapf_road.cpp.

## Member Function Documentation

## ◆ OneTileCost()

template<class Types >

int CYapfCostRoadT< Types >::OneTileCost | ( | TileIndex | tile,
|  | Trackdir | trackdir
| ) |  |
| inlineprotected

return one tile cost

Definition at line 57 of file yapf_road.cpp.

References RoadStop::GetByTile(), RoadStop::GetEntry(), RoadStop::Entry::GetLength(), RoadStop::Entry::GetOccupied(), GetRoadStopType(), GetTileType(), IsDiagonalTrackdir(), RoadStop::IsDriveThroughRoadStopContinuation(), IsDriveThroughStopTile(), RoadStop::IsFreeBay(), IsLevelCrossing(), IsRoadWaypoint(), MP_ROAD, MP_STATION, TileOffsByDiagDir(), TrackdirToExitdir(), CYapfCostRoadT< Types >::Yapf(), YAPF_TILE_CORNER_LENGTH, and YAPF_TILE_LENGTH.

## ◆ PfCalcCost()

template<class Types >

bool CYapfCostRoadT< Types >::PfCalcCost | ( | Node & | n,
|  | const TrackFollower * |
| ) |  |
| inline

Called by YAPF to calculate the cost from the origin to the given node.

Calculates only the cost of given node, adds it to the parent node cost and stores the result into Node::cost member

Definition at line 113 of file yapf_road.cpp.

References Vehicle::current_order, DiagDirToDiagTrackdir(), FindFirstBit(), RoadVehicle::GetDisplayMaxSpeed(), Order::GetMaxSpeed(), GetRoadDepotDirection(), IsRoadDepotTile(), KillFirstBit(), MAX_MAP_SIZE, ReverseDiagDir(), TRACKDIR_BIT_NONE, CYapfCostRoadT< Types >::Yapf(), and YAPF_TILE_LENGTH.

## ◆ SetMaxCost()

template<class Types >

void CYapfCostRoadT< Types >::SetMaxCost | ( | int | max_cost | ) |
| inline

Definition at line 103 of file yapf_road.cpp.

## ◆ SlopeCost()

template<class Types >

int CYapfCostRoadT< Types >::SlopeCost | ( | TileIndex | tile,
|  | TileIndex | next_tile,
|  | Trackdir |
| ) |  |
| inlineprotected

Definition at line 37 of file yapf_road.cpp.

## ◆ Yapf()

template<class Types >

Tpf & CYapfCostRoadT< Types >::Yapf | ( |  | ) |
| inlineprotected

to access inherited path finder

Definition at line 32 of file yapf_road.cpp.

Referenced by CYapfCostRoadT< Types >::OneTileCost(), and CYapfCostRoadT< Types >::PfCalcCost().

## Field Documentation

## ◆ max_cost

template<class Types >

int CYapfCostRoadT< Types >::max_cost
| protected

Definition at line 27 of file yapf_road.cpp.

The documentation for this class was generated from the following file:

- src/pathfinder/yapf/yapf_road.cpp