Dragonfly 4.20
A text-based game engine
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
df::PathManager Class Reference
Inheritance diagram for df::PathManager:
Inheritance graph

Public Member Functions

int startUp () override
 
void shutDown () override
 
int registerPathFind (PathFind *p_path_find)
 
int unregisterPathFind (PathFind *p_path_find)
 
void setMinCycleTime (int new_min_cycle_time)
 
int getMinCycleTime () const
 
int getPathFinders () const
 
void cycle (int max_cycle_time=-1)
 
- Public Member Functions inherited from df::Manager
std::string getType () const
 
virtual int startUp ()
 
virtual void shutDown ()
 
bool isStarted () const
 
int onEvent (const Event *p_event) const
 
int registerInterest (Object *p_o, std::string event_type)
 
int unregisterInterest (Object *p_o, std::string event_type)
 

Static Public Member Functions

static PathManagergetInstance ()
 

Private Member Functions

 PathManager ()
 
 PathManager (PathManager const &)
 
void operator= (PathManager const &)
 

Private Attributes

std::vector< PathFind * > m_finder
 
int m_min_cycle_time
 

Additional Inherited Members

- Protected Member Functions inherited from df::Manager
void setType (std::string new_type)
 

Constructor & Destructor Documentation

◆ PathManager() [1/2]

df::PathManager::PathManager ( )
private

Private since a singleton.

◆ PathManager() [2/2]

df::PathManager::PathManager ( PathManager const &  )
private

Don't allow copy.

Member Function Documentation

◆ cycle()

void df::PathManager::cycle ( int  max_cycle_time = -1)

Cycle through registered PathFinders.

Spend at least min_cycle time, but no more than max_cycle_time.

◆ getInstance()

static PathManager & df::PathManager::getInstance ( )
static

Get the one and only instance of the PathManager.

◆ getMinCycleTime()

int df::PathManager::getMinCycleTime ( ) const

Get minimum cycle time (minimum game loop time spent pathfinding).

◆ getPathFinders()

int df::PathManager::getPathFinders ( ) const

Return number of PathFind-ers.

◆ operator=()

void df::PathManager::operator= ( PathManager const &  )
private

Don't allow assignment.

◆ registerPathFind()

int df::PathManager::registerPathFind ( PathFind p_path_find)

Register PathFind with PathManager.

Return 0 if ok, else -1.

◆ setMinCycleTime()

void df::PathManager::setMinCycleTime ( int  new_min_cycle_time)

Set minimum cycle time (minimum game loop time spent pathfinding).

◆ shutDown()

void df::PathManager::shutDown ( )
overridevirtual

Shut down PathManager.

Reimplemented from df::Manager.

◆ startUp()

int df::PathManager::startUp ( )
overridevirtual

Start up PathManager.

Set min cycle time default to 1/10 frame time.

Reimplemented from df::Manager.

◆ unregisterPathFind()

int df::PathManager::unregisterPathFind ( PathFind p_path_find)

Unregister PathFind with PathManager.

Return 0 if ok, else -1.

Member Data Documentation

◆ m_finder

std::vector<PathFind *> df::PathManager::m_finder
private

PathFind's registered.

◆ m_min_cycle_time

int df::PathManager::m_min_cycle_time
private

Min pathfinding time, in millisec.