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

YAPF destination provider base class - used when destination is single tile / multiple trackdirs. More...

#include <yapf_common.hpp>

Inheritance diagram for CYapfDestinationTileT< Types >:
CYapfT< CYapfShip_TypesT< CYapfShip1, CFollowTrackWater, CShipNodeListTrackDir > > CYapfT< CYapfShip_TypesT< CYapfShip2, CFollowTrackWater, CShipNodeListExitDir > > CYapfT< CYapfShip_TypesT< CYapfShip3, CFollowTrackWaterNo90, CShipNodeListTrackDir > > CYapfShip1 CYapfShip2 CYapfShip3

Public Types

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

Public Member Functions

void SetDestination (TileIndex tile, TrackdirBits trackdirs)
 set the destination tile / more trackdirs
bool PfDetectDestination (Node &n)
 Called by YAPF to detect if node ends in the desired destination.
bool PfCalcEstimate (Node &n)
 Called by YAPF to calculate cost estimate.

Protected Member Functions

TpfYapf ()
 to access inherited path finder

Protected Attributes

TileIndex m_destTile
 destination tile
TrackdirBits m_destTrackdirs
 destination trackdir mask

Detailed Description

template<class Types>
class CYapfDestinationTileT< Types >

YAPF destination provider base class - used when destination is single tile / multiple trackdirs.

Definition at line 115 of file yapf_common.hpp.

Member Function Documentation

template<class Types >
bool CYapfDestinationTileT< Types >::PfCalcEstimate ( Node n)
inline

Called by YAPF to calculate cost estimate.

Calculates distance to the destination adds it to the actual cost from origin and stores the sum to the Node::m_estimate

Definition at line 153 of file yapf_common.hpp.

References abs(), CYapfDestinationTileT< Types >::m_destTile, min(), CYapfDestinationTileT< Types >::PfDetectDestination(), TileX(), TileY(), TrackdirToExitdir(), YAPF_TILE_CORNER_LENGTH, and YAPF_TILE_LENGTH.


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