OpenTTD Source 20241224-master-gee860a5c8e
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

TpfYapf ()
 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 25 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 24 of file yapf_road.cpp.

◆ Tpf

template<class Types >
typedef Types::Tpf CYapfCostRoadT< Types >::Tpf

pathfinder (derived from THIS class)

Definition at line 22 of file yapf_road.cpp.

◆ TrackFollower

template<class Types >
typedef Types::TrackFollower CYapfCostRoadT< Types >::TrackFollower

track follower helper

Definition at line 23 of file yapf_road.cpp.

Constructor & Destructor Documentation

◆ CYapfCostRoadT()

template<class Types >
CYapfCostRoadT< Types >::CYapfCostRoadT ( )
inlineprotected

Definition at line 30 of file yapf_road.cpp.

Member Function Documentation

◆ OneTileCost()

◆ 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 114 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 104 of file yapf_road.cpp.

◆ SlopeCost()

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

Definition at line 38 of file yapf_road.cpp.

◆ Yapf()

template<class Types >
Tpf & CYapfCostRoadT< Types >::Yapf ( )
inlineprotected

to access inherited path finder

Definition at line 33 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 28 of file yapf_road.cpp.


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