Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Member Functions | List of all members
OpenSkyNet::Core::PathFinder Class Reference

#include <CPathFinder.h>

Inheritance diagram for OpenSkyNet::Core::PathFinder:
OpenSkyNet::Core::Updater

Classes

struct  PathFinderInfo
 

Public Member Functions

 PathFinder ()
 
virtual ~PathFinder ()
 
virtual bool update (float dt_)
 
virtual bool setPriority (Object *obj_, OBJECT_PRIORITY prio_)
 
virtual void setPFGrid (const Math::Point<> *corners_, std::set< CD::Volume * > &obstacles_)
 
virtual void setPFOptions (Object *driver_, Object *target_, float targetRadius_, PF::Manager::ALGORITHM algo_, bool createSpline_, bool resetPFVars_, bool assignToDriver_, Math::Path &path_, double secsAllottedPerUpdate_=0.00033)
 
virtual PF::RESULT findPath (Object *driver_, Object *target_)
 
PF::ManagergetPFManager (Object *obj_)
 
Math::PathgetPath (Object *obj_)
 
- Public Member Functions inherited from OpenSkyNet::Core::Updater
 Updater ()
 
 Updater (UPDATER_TYPE type_, const char *typeName_, UPDATER_PRIORITY prio_, float interval_)
 
virtual ~Updater ()
 
UPDATER_TYPE getType () const
 
const std::string & getTypeName () const
 
float getInterval () const
 
void setInterval (float interval_)
 
Utils::uint getNumObjects () const
 
Utils::uint getNumObjectsThatCanUpdate () const
 
bool find (Object *obj_) const
 
UPDATER_PRIORITY getPriority () const
 
OBJECT_PRIORITY getPriority (Object *obj_) const
 

Protected Member Functions

virtual bool addObject (Object *obj_, Updater::OBJECT_PRIORITY prio_=Updater::OBJ_1, bool isOneShot_=false)
 
virtual bool removeObject (Object *obj_)
 
- Protected Member Functions inherited from OpenSkyNet::Core::Updater
virtual void removeAllObjects ()
 
int getNumToUpdate (float dt_)
 
void allObjectsUpdated ()
 
void setPriority (UPDATER_PRIORITY prio_)
 

Additional Inherited Members

- Public Types inherited from OpenSkyNet::Core::Updater
enum  UPDATER_TYPE {
  BASE, AI, CAMERA, PATH_FINDER,
  PATH, TRANSFORM_INTERPOLATOR, PHYSICS, ANIMATION,
  COLLISION_DETECTOR, PHYS_VIS, TRANSFORM_CHANGE_DETECTOR, CORE_MAX,
  MAX =32
}
 
enum  UPDATER_PRIORITY {
  UPD_DISABLED, UPD_1, UPD_2, UPD_3,
  UPD_4, UPD_5, UPD_6, UPD_7,
  UPD_8, UPD_NUM_PRIORITIES
}
 
enum  OBJECT_PRIORITY {
  OBJ_DISABLED, OBJ_1, OBJ_2, OBJ_3,
  OBJ_NUM_PRIORITIES
}
 
typedef std::map< Object
*, UpdateInfo * > 
ObjMap
 
- Protected Attributes inherited from OpenSkyNet::Core::Updater
std::list< Object * > _objLists [OBJ_NUM_PRIORITIES]
 
ObjMap _objMap
 
UPDATER_TYPE _type
 
std::string _typeName
 
UPDATER_PRIORITY _prio
 
float _interval
 
float _dtSinceAllWereUpdated
 
float _prevTotalTimeForAllUpdates
 
float _partialUpdate
 
int _currPrio
 
std::list< Object * >::iterator _currObj
 

Detailed Description

Finds a path to a target once every interval.

Constructor & Destructor Documentation

OpenSkyNet::Core::PathFinder::PathFinder ( )
inline
virtual OpenSkyNet::Core::PathFinder::~PathFinder ( )
inlinevirtual

Member Function Documentation

bool PathFinder::addObject ( Object obj_,
Updater::OBJECT_PRIORITY  prio_ = Updater::OBJ_1,
bool  isOneShot_ = false 
)
protectedvirtual

Returns false if obj_ is already in this updater.

Reimplemented from OpenSkyNet::Core::Updater.

RESULT PathFinder::findPath ( Object driver_,
Object target_ 
)
virtual

Find a path between two objects. See also PF::Manager::findPath(). This method is called automatically by update().

Parameters
driver_= the object to begin a path at
target_= the object to finish a path at
Math::Path* OpenSkyNet::Core::PathFinder::getPath ( Object obj_)
inline
PF::Manager* OpenSkyNet::Core::PathFinder::getPFManager ( Object obj_)
inline
bool PathFinder::removeObject ( Object obj_)
protectedvirtual

Returns false if obj_ is not in this updater.

Reimplemented from OpenSkyNet::Core::Updater.

void PathFinder::setPFGrid ( const Math::Point<> *  corners_,
std::set< CD::Volume * > &  obstacles_ 
)
virtual

NOTE: MUST be called at least once before any calls to AddObject().

void PathFinder::setPFOptions ( Object driver_,
Object target_,
float  targetRadius_,
PF::Manager::ALGORITHM  algo_,
bool  createSpline_,
bool  resetPFVars_,
bool  assignToDriver_,
Math::Path path_,
double  secsAllottedPerUpdate_ = 0.00033 
)
virtual

Set pathfinding options.

Parameters
driver_= the object to begin paths at
target_= the object to finish paths at
targetRadius_if < 0, then the target's bounding volume determines where the target is found
algo_= the graph algorithm to use for pathfinding
createSpline_= create a natural cubic spline from the path
resetPFVars_= reset pathfinding variables in the PF::Manager
assignToDriver_= assign the path to the driver
path_= storage for the found path
secsAllottedPerUpdate_= Default value allows 1 object to pathfind using 1% of each frame's time if the fps are slightly > 30.
bool PathFinder::setPriority ( Object obj_,
Updater::OBJECT_PRIORITY  prio_ 
)
virtual

Reimplemented from OpenSkyNet::Core::Updater.

bool PathFinder::update ( float  dt_)
virtual

Returns true if all objects were updated over the current interval (that's interval, not dt_), false if objects are left to be updated (see class description).

Parameters
dt_= seconds to update an object this call. dt_ accumulates for objects not updated.

Reimplemented from OpenSkyNet::Core::Updater.


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