OpenTTD Source 20260206-master-g4d4e37dbf1
CYapfRail Struct Reference
Inheritance diagram for CYapfRail:
CYapfRailBase< CYapfRail_TypesT< CYapfRail, CFollowTrackRail, CYapfDestinationTileOrStationRailT, CYapfFollowRailT > > CYapfT< CYapfRail_TypesT< CYapfRail, CFollowTrackRail, CYapfDestinationTileOrStationRailT, CYapfFollowRailT > > CYapfBaseT< Types > CYapfCostRailT< Types > CYapfSegmentCostCacheGlobalT< Types > CYapfOriginTileTwoWayT< Types > CYapfDestinationAnyDepotRailT< Types > CYapfFollowAnyDepotRailT< Types > CYapfCostBase CYapfDestinationRailBase

Additional Inherited Members

Public Types inherited from CYapfRailBase< CYapfRail_TypesT< CYapfRail, CFollowTrackRail, CYapfDestinationTileOrStationRailT, CYapfFollowRailT > >
typedef CYapfRail_TypesT< CYapfRail, CFollowTrackRail, CYapfDestinationTileOrStationRailT, CYapfFollowRailT >::NodeList::Item Node
Public Types inherited from CYapfBaseT< Types >
typedef Types::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef Types::TrackFollower TrackFollower
typedef Types::NodeList NodeList
 our node list
typedef Types::VehicleType VehicleType
 the type of vehicle
typedef NodeList::Item Node
 this will be our node type
typedef Node::Key Key
 key to hash tables
Public Types inherited from CYapfCostRailT< 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
typedef Node::CachedData CachedData
Public Types inherited from CYapfSegmentCostCacheGlobalT< Types >
typedef Types::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef Types::NodeList::Item Node
 this will be our node type
typedef Node::Key Key
 key to hash tables
typedef Node::CachedData CachedData
typedef CachedData::Key CacheKey
typedef CSegmentCostCacheT< CachedData > Cache
using LocalCache = std::deque<CachedData>
Public Types inherited from CYapfOriginTileTwoWayT< Types >
typedef Types::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef Types::NodeList::Item Node
 this will be our node type
typedef Node::Key Key
 key to hash tables
Public Types inherited from CYapfDestinationAnyDepotRailT< Types >
typedef Types::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef Types::NodeList::Item Node
 this will be our node type
typedef Node::Key Key
 key to hash tables
Public Types inherited from CYapfFollowAnyDepotRailT< 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 inherited from CYapfRailBase< CYapfRail_TypesT< CYapfRail, CFollowTrackRail, CYapfDestinationTileOrStationRailT, CYapfFollowRailT > >
void PruneIntermediateNodeBranch (Node *n)
 In some cases an intermediate node branch should be pruned.
Public Member Functions inherited from CYapfBaseT< Types >
 CYapfBaseT ()
 default constructor
 ~CYapfBaseT ()
 default destructor
const YAPFSettingsPfGetSettings () const
 return current settings (can be custom - company based - but later)
bool FindPath (const VehicleType *v)
 Main pathfinder routine:
NodeGetBestNode ()
 If path was found return the best node that has reached the destination.
NodeCreateNewNode ()
 Calls NodeList::CreateNewNode() - allocates new node that can be filled and used as argument for AddStartupNode() or AddNewNode().
void AddStartupNode (Node &n)
 Add new node (created by CreateNewNode and filled with data) into open list.
void AddMultipleNodes (Node *parent, const TrackFollower &tf)
 add multiple nodes - direct children of the given node
void AddNewNode (Node &n, const TrackFollower &follower)
 AddNewNode() - called by Tderived::PfFollowNode() for each child node.
const VehicleTypeGetVehicle () const
void DumpBase (DumpTarget &dmp) const
Public Member Functions inherited from CYapfCostRailT< Types >
void SetTreatFirstRedTwoWaySignalAsEOL (bool enabled)
 Sets whether the first two-way signal should be treated as a dead end.
bool TreatFirstRedTwoWaySignalAsEOL ()
 Returns whether the first two-way signal should be treated as a dead end.
int SlopeCost (TileIndex tile, Trackdir td)
int CurveCost (Trackdir td1, Trackdir td2)
int SwitchCost (TileIndex tile1, TileIndex tile2, DiagDirection exitdir)
int OneTileCost (TileIndex &tile, Trackdir trackdir)
 Return one tile cost (base cost + level crossing penalty).
bool IsAnyStationTileReserved (TileIndex tile, Trackdir trackdir, int skipped)
 Check for a reserved station platform.
int ReservationCost (Node &n, TileIndex tile, Trackdir trackdir, int skipped)
 The cost for reserved tiles, including skipped ones.
int SignalCost (Node &n, TileIndex tile, Trackdir trackdir)
int PlatformLengthPenalty (int platform_length)
void SetMaxCost (int max_cost)
bool PfCalcCost (Node &n, const TrackFollower *follower)
 Called by YAPF to calculate the cost from the origin to the given node.
bool CanUseGlobalCache (Node &n) const
void ConnectNodeToCachedData (Node &n, CachedData &ci)
void DisableCache (bool disable)
Public Member Functions inherited from CYapfSegmentCostCacheGlobalT< Types >
bool PfNodeCacheFetch (Node &n)
 Called by YAPF to attach cached or local segment cost data to the given node.
Public Member Functions inherited from CYapfOriginTileTwoWayT< Types >
void SetOrigin (TileIndex forward_tile, Trackdir forward_td, TileIndex reverse_tile=INVALID_TILE, Trackdir reverse_td=INVALID_TRACKDIR, int reverse_penalty=0)
 set origin (tiles, trackdirs, etc.)
Public Member Functions inherited from CYapfDestinationAnyDepotRailT< Types >
TpfYapf ()
 to access inherited path finder
bool PfDetectDestination (Node &n)
 Called by YAPF to detect if node ends in the desired destination.
bool PfDetectDestination (TileIndex tile, Trackdir)
 Called by YAPF to detect if node ends in the desired destination.
bool PfCalcEstimate (Node &n)
 Called by YAPF to calculate cost estimate.
Public Member Functions inherited from CYapfDestinationRailBase
void SetDestination (const Train *v, bool override_rail_type=false)
bool IsCompatibleRailType (RailType rt)
RailTypes GetCompatibleRailTypes () const
Public Member Functions inherited from CYapfFollowAnyDepotRailT< Types >
void PfFollowNode (Node &old_node)
 Called by YAPF to move from the given node to the next tile.
char TransportTypeChar () const
 return debug report character to identify the transportation type
FindDepotData FindNearestDepotTwoWay (const Train *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_penalty, int reverse_penalty)
Static Public Member Functions inherited from CYapfCostBase
static bool stSlopeCost (TileIndex tile, Trackdir td)
 Does the given track direction on the given tile yield an uphill penalty?
Static Public Member Functions inherited from CYapfFollowAnyDepotRailT< Types >
static FindDepotData stFindNearestDepotTwoWay (const Train *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_penalty, int reverse_penalty)
Data Fields inherited from CYapfBaseT< Types >
NodeList nodes
 node list multi-container
int num_steps = 0
 this is there for debugging purposes (hope it doesn't hurt)
Data Fields inherited from CYapfCostRailT< Types >
bool stopped_on_first_two_way_signal = false
Protected Member Functions inherited from CYapfBaseT< Types >
TpfYapf ()
 to access inherited path finder
Protected Member Functions inherited from CYapfCostRailT< Types >
TpfYapf ()
 to access inherited path finder
Protected Member Functions inherited from CYapfSegmentCostCacheGlobalT< Types >
TpfYapf ()
 to access inherited path finder
Protected Member Functions inherited from CYapfOriginTileTwoWayT< Types >
TpfYapf ()
 to access inherited path finder
Protected Member Functions inherited from CYapfFollowAnyDepotRailT< Types >
TpfYapf ()
 to access inherited path finder
Static Protected Member Functions inherited from CYapfSegmentCostCacheGlobalT< Types >
static Cache & stGetGlobalCache ()
Protected Attributes inherited from CYapfBaseT< Types >
Nodebest_dest_node = nullptr
 pointer to the destination node found at last round
Nodebest_intermediate_node = nullptr
 here should be node closest to the destination if path not found
const YAPFSettingssettings
 current settings (_settings_game.yapf)
int max_search_nodes
 maximum number of nodes we are allowed to visit before we give up
const VehicleTypevehicle = nullptr
 vehicle that we are trying to drive
int stats_cost_calcs = 0
 stats - how many node's costs were calculated
int stats_cache_hits = 0
 stats - how many node's costs were reused from cache
Protected Attributes inherited from CYapfCostRailT< Types >
int max_cost = 0
bool disable_cache = false
std::vector< int > sig_look_ahead_costs = {}
bool treat_first_red_two_way_signal_as_eol = false
Protected Attributes inherited from CYapfSegmentCostCacheGlobalT< Types >
Cache & global_cache
LocalCache local_cache
Protected Attributes inherited from CYapfDestinationRailBase
RailTypes compatible_railtypes
Static Protected Attributes inherited from CYapfCostRailT< Types >
static constexpr int MAX_SEGMENT_COST = 10000

Detailed Description

Definition at line 570 of file yapf_rail.cpp.


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