CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
abstract_pathfinder Class Referenceabstract

#include <th_pathfind.h>

Inheritance diagram for abstract_pathfinder:
basic_pathfinder hospital_finder idle_tile_finder object_visitor

Public Member Functions

 abstract_pathfinder (pathfinder *pf)
 
virtual ~abstract_pathfinder ()=default
 
path_nodeinit (const level_map *pMap, int iStartX, int iStarty)
 Initialize the path finder.
 
bool search_neighbours (path_node *pNode, map_tile_flags flags, int iWidth)
 Expand the pNode to its neighbours.
 
void record_neighbour_if_passable (path_node *pNode, map_tile_flags neighbour_flags, bool passable, path_node *pNeighbour)
 
virtual int guess_distance (path_node *pNode)=0
 Guess distance to the destination for pNode.
 
virtual bool try_node (path_node *pNode, map_tile_flags flags, path_node *pNeighbour, travel_direction direction)=0
 Try the pNeighbour node.
 

Protected Attributes

pathfinderparent
 Path finder parent object, containing shared data.
 
const level_mapmap
 Map being searched.
 

Detailed Description

Base class of the path finders.

Constructor & Destructor Documentation

◆ abstract_pathfinder()

abstract_pathfinder::abstract_pathfinder ( pathfinder pf)

◆ ~abstract_pathfinder()

virtual abstract_pathfinder::~abstract_pathfinder ( )
virtualdefault

Member Function Documentation

◆ guess_distance()

virtual int abstract_pathfinder::guess_distance ( path_node pNode)
pure virtual

Guess distance to the destination for pNode.

Parameters
pNodeNode to fill.

Implemented in basic_pathfinder, hospital_finder, idle_tile_finder, and object_visitor.

◆ init()

path_node * abstract_pathfinder::init ( const level_map pMap,
int  iStartX,
int  iStarty 
)

Initialize the path finder.

Parameters
pMapMap to search on.
iStartXX coordinate of the start position.
iStartyY coordinate of the start position.
Returns
The initial node to expand.

◆ record_neighbour_if_passable()

void abstract_pathfinder::record_neighbour_if_passable ( path_node pNode,
map_tile_flags  neighbour_flags,
bool  passable,
path_node pNeighbour 
)

◆ search_neighbours()

bool abstract_pathfinder::search_neighbours ( path_node pNode,
map_tile_flags  flags,
int  iWidth 
)

Expand the pNode to its neighbours.

Parameters
pNodeNode to expand.
flagsFlags of the node.
iWidthWidth of the map.
Returns
Whether the search is done.

No need to check for the node being on the map edge, as the N/E/S/W flags are set as to prevent travelling off the map (as well as to prevent walking through walls).

◆ try_node()

virtual bool abstract_pathfinder::try_node ( path_node pNode,
map_tile_flags  flags,
path_node pNeighbour,
travel_direction  direction 
)
pure virtual

Try the pNeighbour node.

Parameters
pNodeSource node.
flagsFlags of the node.
pNeighbourNeighbour of pNode to try.
directionDirection of travel.
Returns
Whether the search is done.

Implemented in basic_pathfinder, hospital_finder, idle_tile_finder, and object_visitor.

Member Data Documentation

◆ map

const level_map* abstract_pathfinder::map
protected

Map being searched.

◆ parent

pathfinder* abstract_pathfinder::parent
protected

Path finder parent object, containing shared data.


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