OpenTTD Source 20260208-master-g43af8e94d0
YapfShipRegions Class Reference

Water region based YAPF implementation for ships. More...

Inheritance diagram for YapfShipRegions:
CYapfBaseT< WaterRegionTypes > CYapfSegmentCostCacheNoneT< WaterRegionTypes >

Public Member Functions

 YapfShipRegions (int max_nodes)
void AddOrigin (const WaterRegionPatchDesc &water_region_patch)
bool HasOrigin (const WaterRegionPatchDesc &water_region_patch)
void SetDestination (const WaterRegionPatchDesc &water_region_patch)
void PfFollowNode (Node &old_node)
bool PfDetectDestination (Node &n) const
bool PfCalcCost (Node &n, const TrackFollower *)
bool PfCalcEstimate (Node &n)
char TransportTypeChar () const
Public Member Functions inherited from CYapfBaseT< WaterRegionTypes >
 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 CYapfSegmentCostCacheNoneT< WaterRegionTypes >
bool PfNodeCacheFetch (Node &)
 Called by YAPF to attach cached or local segment cost data to the given node.

Static Public Member Functions

static std::vector< WaterRegionPatchDescFindWaterRegionPath (const Ship *v, TileIndex start_tile, int max_returned_path_length)

Private Types

using Node = typename WaterRegionTypes::NodeList::Item

Private Member Functions

YapfShipRegionsYapf ()

Private Attributes

std::vector< WaterRegionPatchKeyorigin_keys
WaterRegionPatchKey dest

Additional Inherited Members

Public Types inherited from CYapfBaseT< WaterRegionTypes >
typedef WaterRegionTypes::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef WaterRegionTypes::TrackFollower TrackFollower
typedef WaterRegionTypes::NodeList NodeList
 our node list
typedef WaterRegionTypes::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 CYapfSegmentCostCacheNoneT< WaterRegionTypes >
typedef WaterRegionTypes::Tpf Tpf
 the pathfinder class (derived from THIS class)
typedef WaterRegionTypes::NodeList::Item Node
 this will be our node type
Data Fields inherited from CYapfBaseT< WaterRegionTypes >
NodeList nodes
 node list multi-container
int num_steps
 this is there for debugging purposes (hope it doesn't hurt)
Protected Member Functions inherited from CYapfBaseT< WaterRegionTypes >
TpfYapf ()
 to access inherited path finder
Protected Attributes inherited from CYapfBaseT< WaterRegionTypes >
Nodebest_dest_node
 pointer to the destination node found at last round
Nodebest_intermediate_node
 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
 vehicle that we are trying to drive
int stats_cost_calcs
 stats - how many node's costs were calculated
int stats_cache_hits
 stats - how many node's costs were reused from cache

Detailed Description

Water region based YAPF implementation for ships.

Definition at line 92 of file yapf_ship_regions.cpp.

Member Typedef Documentation

◆ Node

using YapfShipRegions::Node = typename WaterRegionTypes::NodeList::Item
private

Definition at line 97 of file yapf_ship_regions.cpp.

Constructor & Destructor Documentation

◆ YapfShipRegions()

YapfShipRegions::YapfShipRegions ( int max_nodes)
inlineexplicit

Definition at line 108 of file yapf_ship_regions.cpp.

Member Function Documentation

◆ AddOrigin()

void YapfShipRegions::AddOrigin ( const WaterRegionPatchDesc & water_region_patch)
inline

Definition at line 113 of file yapf_ship_regions.cpp.

◆ FindWaterRegionPath()

std::vector< WaterRegionPatchDesc > YapfShipRegions::FindWaterRegionPath ( const Ship * v,
TileIndex start_tile,
int max_returned_path_length )
inlinestatic

Definition at line 177 of file yapf_ship_regions.cpp.

◆ HasOrigin()

bool YapfShipRegions::HasOrigin ( const WaterRegionPatchDesc & water_region_patch)
inline

Definition at line 124 of file yapf_ship_regions.cpp.

◆ PfCalcCost()

bool YapfShipRegions::PfCalcCost ( Node & n,
const TrackFollower *  )
inline

Definition at line 149 of file yapf_ship_regions.cpp.

◆ PfCalcEstimate()

bool YapfShipRegions::PfCalcEstimate ( Node & n)
inline

Definition at line 163 of file yapf_ship_regions.cpp.

◆ PfDetectDestination()

bool YapfShipRegions::PfDetectDestination ( Node & n) const
inline

Definition at line 144 of file yapf_ship_regions.cpp.

◆ PfFollowNode()

void YapfShipRegions::PfFollowNode ( Node & old_node)
inline

Definition at line 134 of file yapf_ship_regions.cpp.

◆ SetDestination()

void YapfShipRegions::SetDestination ( const WaterRegionPatchDesc & water_region_patch)
inline

Definition at line 129 of file yapf_ship_regions.cpp.

◆ TransportTypeChar()

char YapfShipRegions::TransportTypeChar ( ) const
inline

Definition at line 175 of file yapf_ship_regions.cpp.

◆ Yapf()

YapfShipRegions & YapfShipRegions::Yapf ( )
inlineprivate

Definition at line 102 of file yapf_ship_regions.cpp.

Field Documentation

◆ dest

WaterRegionPatchKey YapfShipRegions::dest
private

Definition at line 100 of file yapf_ship_regions.cpp.

◆ origin_keys

std::vector<WaterRegionPatchKey> YapfShipRegions::origin_keys
private

Definition at line 99 of file yapf_ship_regions.cpp.


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