OpenTTD Source 20260206-master-g4d4e37dbf1
CYapfShip Struct Reference
Inheritance diagram for CYapfShip:
CYapfT< CYapfShip_TypesT< CYapfShip > > CYapfBaseT< Types > CYapfCostShipT< Types > CYapfSegmentCostCacheNoneT< Types > CYapfOriginTileT< Types > CYapfDestinationTileWaterT< Types > CYapfFollowShipT< Types >

Public Member Functions

 CYapfShip (int max_nodes)
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 CYapfCostShipT< Types >
TpfYapf ()
 to access inherited path finder
int CurveCost (Trackdir td1, Trackdir td2)
bool PfCalcCost (Node &n, const TrackFollower *follower)
 Called by YAPF to calculate the cost from the origin to the given node.
Public Member Functions inherited from CYapfSegmentCostCacheNoneT< Types >
bool PfNodeCacheFetch (Node &)
 Called by YAPF to attach cached or local segment cost data to the given node.
Public Member Functions inherited from CYapfOriginTileT< Types >
void SetOrigin (TileIndex tile, TrackdirBits trackdirs)
 Set origin tile / trackdir mask.
Public Member Functions inherited from CYapfDestinationTileWaterT< Types >
void SetDestination (const Ship *v)
void SetIntermediateDestination (const WaterRegionPatchDesc &water_region_patch)
bool PfDetectDestination (Node &n)
 Called by YAPF to detect if node ends in the desired destination.
bool PfDetectDestinationTile (TileIndex tile, Trackdir trackdir)
bool PfCalcEstimate (Node &n)
 Called by YAPF to calculate cost estimate.
Public Member Functions inherited from CYapfFollowShipT< Types >
void PfFollowNode (Node &old_node)
 Called by YAPF to move from the given node to the next tile.
void RestrictSearch (const std::vector< WaterRegionPatchDesc > &path)
 Restricts the search by creating corridor or water regions through which the ship is allowed to travel.
char TransportTypeChar () const
 Return debug report character to identify the transportation type.

Additional Inherited Members

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 CYapfCostShipT< 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 Types inherited from CYapfSegmentCostCacheNoneT< Types >
typedef Types::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef Types::NodeList::Item Node
 this will be our node type
Public Types inherited from CYapfOriginTileT< 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 CYapfDestinationTileWaterT< 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 Types inherited from CYapfFollowShipT< 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.
Static Public Member Functions inherited from CYapfCostShipT< Types >
static bool IsPreferredShipDirection (TileIndex tile, Trackdir td)
 Whether the provided direction is a preferred direction for a given tile.
Static Public Member Functions inherited from CYapfFollowShipT< Types >
static Trackdir GetRandomTrackdir (TrackdirBits trackdirs)
 Returns a random trackdir out of a set of trackdirs.
static std::pair< TileIndex, TrackdirGetRandomFollowUpTileTrackdir (const Ship *v, TileIndex tile, Trackdir dir)
 Returns a random tile/trackdir that can be reached from the current tile/trackdir, or tile/INVALID_TRACK if none is available.
static Trackdir CreateRandomPath (const Ship *v, ShipPathCache &path_cache, int path_length)
 Creates a random path, avoids 90 degree turns.
static Trackdir ChooseShipTrack (const Ship *v, TileIndex tile, TrackdirBits forward_dirs, TrackdirBits reverse_dirs, bool &path_found, ShipPathCache &path_cache, Trackdir &best_origin_dir)
static bool CheckShipReverse (const Ship *v, Trackdir *trackdir)
 Check whether a ship should reverse to reach its destination.
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)
Protected Member Functions inherited from CYapfBaseT< Types >
TpfYapf ()
 to access inherited path finder
Protected Member Functions inherited from CYapfOriginTileT< Types >
TpfYapf ()
 to access inherited path finder
Protected Member Functions inherited from CYapfDestinationTileWaterT< Types >
TpfYapf ()
 To access inherited path finder.
Protected Member Functions inherited from CYapfFollowShipT< Types >
TpfYapf ()
 to access inherited path finder
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 CYapfDestinationTileWaterT< Types >
TileIndex dest_tile
TrackdirBits dest_trackdirs
StationID dest_station
bool has_intermediate_dest = false
TileIndex intermediate_dest_tile
WaterRegionPatchDesc intermediate_dest_region_patch
Protected Attributes inherited from CYapfFollowShipT< Types >
std::vector< WaterRegionDescwater_region_corridor

Detailed Description

Definition at line 425 of file yapf_ship.cpp.

Constructor & Destructor Documentation

◆ CYapfShip()

CYapfShip::CYapfShip ( int max_nodes)
inlineexplicit

Definition at line 426 of file yapf_ship.cpp.


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