OpenTTD Source 20250924-master-gbec4e71d53
CYapfCostShipT< Types > Class Template Reference

Cost Provider module of YAPF for ships. More...

Public Types

typedef Types::Tpf Tpf
 the pathfinder class (derived from THIS class).
 
typedef Types::TrackFollower TrackFollower
 
typedef Types::NodeList::Item Node
 this will be our node type.
 
typedef Node::Key Key
 key to hash tables.
 

Public Member Functions

TpfYapf ()
 to access inherited path finder
 
int CurveCost (Trackdir td1, Trackdir td2)
 
bool PfCalcCost (Node &n, const TrackFollower *tf)
 Called by YAPF to calculate the cost from the origin to the given node.
 

Static Public Member Functions

static bool IsPreferredShipDirection (TileIndex tile, Trackdir td)
 Whether the provided direction is a preferred direction for a given tile.
 

Detailed Description

template<class Types>
class CYapfCostShipT< Types >

Cost Provider module of YAPF for ships.

Definition at line 313 of file yapf_ship.cpp.

Member Typedef Documentation

◆ Key

template<class Types >
typedef Node::Key CYapfCostShipT< Types >::Key

key to hash tables.

Definition at line 318 of file yapf_ship.cpp.

◆ Node

template<class Types >
typedef Types::NodeList::Item CYapfCostShipT< Types >::Node

this will be our node type.

Definition at line 317 of file yapf_ship.cpp.

◆ Tpf

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

the pathfinder class (derived from THIS class).

Definition at line 315 of file yapf_ship.cpp.

◆ TrackFollower

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

Definition at line 316 of file yapf_ship.cpp.

Member Function Documentation

◆ CurveCost()

template<class Types >
int CYapfCostShipT< Types >::CurveCost ( Trackdir  td1,
Trackdir  td2 
)
inline

Definition at line 327 of file yapf_ship.cpp.

◆ IsPreferredShipDirection()

template<class Types >
static bool CYapfCostShipT< Types >::IsPreferredShipDirection ( TileIndex  tile,
Trackdir  td 
)
inlinestatic

Whether the provided direction is a preferred direction for a given tile.

This is used to separate ships travelling in opposite directions.

Parameters
tileTile of current node.
tdTrackdir of current node.
Returns
true if a preferred direction, false otherwise.

Definition at line 348 of file yapf_ship.cpp.

References HasBit(), TileX(), TileY(), TRACKDIR_BIT_LEFT_S, TRACKDIR_BIT_LOWER_E, TRACKDIR_BIT_RIGHT_N, TRACKDIR_BIT_UPPER_W, TRACKDIR_X_NE, TRACKDIR_X_SW, TRACKDIR_Y_NW, and TRACKDIR_Y_SE.

Referenced by CYapfCostShipT< Types >::PfCalcCost().

◆ PfCalcCost()

template<class Types >
bool CYapfCostShipT< Types >::PfCalcCost ( Node n,
const TrackFollower *  tf 
)
inline

◆ Yapf()

template<class Types >
Tpf & CYapfCostShipT< Types >::Yapf ( )
inline

to access inherited path finder

Definition at line 321 of file yapf_ship.cpp.

Referenced by CYapfCostShipT< Types >::PfCalcCost().


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