Pathfinder Class Reference

#include <Pathfinder.h>

List of all members.

Public Member Functions

 Pathfinder ()
 ~Pathfinder ()
void init (Actor *actor, PathfindingState *state=0)
void setTarget (sint32 x, sint32 y, sint32 z)
void setTarget (Item *item, bool hit=false)
bool canReach ()
bool pathfind (std::vector< PathfindingAction > &path)

Static Public Member Functions

static void ConCmd_visualDebug (const Console::ArgvType &argv)

Static Public Attributes

static ObjId visualdebug_actor = 0xFFFF

Protected Member Functions

bool alreadyVisited (sint32 x, sint32 y, sint32 z)
void newNode (PathNode *oldnode, PathfindingState &state, unsigned int steps)
void expandNode (PathNode *node)
unsigned int costHeuristic (PathNode *node)
bool checkTarget (PathNode *node)

Protected Attributes

PathfindingState start
Actoractor
sint32 targetx
sint32 targety
sint32 targetz
Itemtargetitem
bool hitmode
sint32 expandtime
sint32 actor_xd
sint32 actor_yd
sint32 actor_zd
std::list< PathfindingStatevisited
std::priority_queue< PathNode *,
std::vector< PathNode * >,
PathNodeCmp
nodes
std::list< PathNode * > nodelist


Detailed Description

Definition at line 59 of file Pathfinder.h.


Constructor & Destructor Documentation

Pathfinder::Pathfinder (  ) 

Definition at line 118 of file Pathfinder.cpp.

References expandednodes.

Pathfinder::~Pathfinder (  ) 

Definition at line 123 of file Pathfinder.cpp.

References expandednodes, expandtime, nodelist, and pout.


Member Function Documentation

bool Pathfinder::alreadyVisited ( sint32  x,
sint32  y,
sint32  z 
) [protected]

Definition at line 183 of file Pathfinder.cpp.

References visited.

Referenced by expandNode().

bool Pathfinder::canReach (  ) 

try to reach the target by pathfinding

Definition at line 177 of file Pathfinder.cpp.

References pathfind().

bool Pathfinder::checkTarget ( PathNode node  )  [protected]

Definition at line 196 of file Pathfinder.cpp.

References actor, PathfindingState::checkHit(), PathfindingState::checkItem(), PathfindingState::checkPoint(), hitmode, PathNode::state, targetitem, targetx, targety, and targetz.

Referenced by newNode(), and pathfind().

void Pathfinder::ConCmd_visualDebug ( const Console::ArgvType argv  )  [static]

"visualDebug" console command

Definition at line 653 of file Pathfinder.cpp.

References pout, and visualdebug_actor.

Referenced by GUIApp::shutdownGame(), and GUIApp::startupGame().

unsigned int Pathfinder::costHeuristic ( PathNode node  )  [protected]

Definition at line 212 of file Pathfinder.cpp.

References actor_xd, actor_yd, PathNode::cost, PathNode::heuristicTotalCost, PathNode::state, targetx, targety, PathfindingState::x, and PathfindingState::y.

Referenced by newNode().

void Pathfinder::expandNode ( PathNode node  )  [protected]

Definition at line 439 of file Pathfinder.cpp.

References actor, actor_xd, actor_yd, Animation::advance, alreadyVisited(), PathfindingState::combat, PathfindingState::direction, AnimationTracker::evaluateMaxAnimTravel(), expandednodes, AnimationTracker::init(), AnimationTracker::isDone(), Actor::isInCombat(), PathfindingState::lastanim, newNode(), PathNode::state, AnimationTracker::step(), targetitem, targetx, targety, AnimationTracker::updateState(), visited, Animation::walk, PathfindingState::x, PathfindingState::y, and PathfindingState::z.

Referenced by pathfind().

void Pathfinder::init ( Actor actor,
PathfindingState state = 0 
)

Definition at line 137 of file Pathfinder.cpp.

References actor, actor_xd, actor_yd, actor_zd, Item::getFootpadWorld(), PathfindingState::load(), and start.

Referenced by PathfinderProcess::PathfinderProcess(), and PathfinderProcess::run().

void Pathfinder::newNode ( PathNode oldnode,
PathfindingState state,
unsigned int  steps 
) [protected]

Definition at line 370 of file Pathfinder.cpp.

References actor, RenderSurface::BeginPainting(), checkTarget(), PathNode::cost, costHeuristic(), PathNode::depth, PathfindingState::direction, drawpath(), GUIApp::get_instance(), Object::getObjId(), GUIApp::getScreen(), PathNode::heuristicTotalCost, nodelist, nodes, PathNode::parent, perr, PathNode::state, PathNode::stepsfromparent, visualdebug_actor, PathfindingState::x, PathfindingState::y, and PathfindingState::z.

Referenced by expandNode().

bool Pathfinder::pathfind ( std::vector< PathfindingAction > &  path  ) 

pathfind. If true, the found path is returned in path

constant

constant

Definition at line 526 of file Pathfinder.cpp.

References PathfindingAction::action, actor, RenderSurface::BeginPainting(), checkTarget(), Animation::combatStand, PathNode::cost, PathNode::depth, PathfindingAction::direction, drawbox(), drawdot(), Item::dumpInfo(), expandednodes, expandNode(), expandtime, GUIApp::get_instance(), Object::getObjId(), GUIApp::getScreen(), n, nodelist, nodes, PathNode::parent, pout, Animation::stand, start, PathNode::state, PathfindingAction::steps, PathNode::stepsfromparent, targetitem, targetx, targety, targetz, and visualdebug_actor.

Referenced by canReach(), PathfinderProcess::PathfinderProcess(), and PathfinderProcess::run().

void Pathfinder::setTarget ( Item item,
bool  hit = false 
)

Definition at line 158 of file Pathfinder.cpp.

References PathfindingState::combat, Item::getCentre(), Item::getParentAsContainer(), Item::getZ(), hitmode, start, targetitem, targetx, targety, and targetz.

void Pathfinder::setTarget ( sint32  x,
sint32  y,
sint32  z 
)

Definition at line 149 of file Pathfinder.cpp.

References hitmode, targetitem, targetx, targety, and targetz.

Referenced by PathfinderProcess::PathfinderProcess(), and PathfinderProcess::run().


Member Data Documentation

Actor* Pathfinder::actor [protected]

Definition at line 84 of file Pathfinder.h.

Referenced by checkTarget(), expandNode(), init(), newNode(), and pathfind().

sint32 Pathfinder::actor_xd [protected]

Definition at line 90 of file Pathfinder.h.

Referenced by costHeuristic(), expandNode(), and init().

sint32 Pathfinder::actor_yd [protected]

Definition at line 90 of file Pathfinder.h.

Referenced by costHeuristic(), expandNode(), and init().

sint32 Pathfinder::actor_zd [protected]

Definition at line 90 of file Pathfinder.h.

Referenced by init().

sint32 Pathfinder::expandtime [protected]

Definition at line 88 of file Pathfinder.h.

Referenced by pathfind(), and ~Pathfinder().

bool Pathfinder::hitmode [protected]

Definition at line 87 of file Pathfinder.h.

Referenced by checkTarget(), and setTarget().

std::list<PathNode*> Pathfinder::nodelist [protected]

Definition at line 95 of file Pathfinder.h.

Referenced by newNode(), pathfind(), and ~Pathfinder().

std::priority_queue<PathNode*,std::vector<PathNode*>,PathNodeCmp> Pathfinder::nodes [protected]

Definition at line 93 of file Pathfinder.h.

Referenced by newNode(), and pathfind().

PathfindingState Pathfinder::start [protected]

Definition at line 83 of file Pathfinder.h.

Referenced by init(), pathfind(), and setTarget().

Item* Pathfinder::targetitem [protected]

Definition at line 86 of file Pathfinder.h.

Referenced by checkTarget(), expandNode(), pathfind(), and setTarget().

sint32 Pathfinder::targetx [protected]

Definition at line 85 of file Pathfinder.h.

Referenced by checkTarget(), costHeuristic(), expandNode(), pathfind(), and setTarget().

sint32 Pathfinder::targety [protected]

Definition at line 85 of file Pathfinder.h.

Referenced by checkTarget(), costHeuristic(), expandNode(), pathfind(), and setTarget().

sint32 Pathfinder::targetz [protected]

Definition at line 85 of file Pathfinder.h.

Referenced by checkTarget(), pathfind(), and setTarget().

std::list<PathfindingState> Pathfinder::visited [protected]

Definition at line 92 of file Pathfinder.h.

Referenced by alreadyVisited(), and expandNode().

ObjId Pathfinder::visualdebug_actor = 0xFFFF [static]

Definition at line 78 of file Pathfinder.h.

Referenced by ConCmd_visualDebug(), newNode(), and pathfind().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:46 2007 for pentagram by  doxygen 1.4.7