FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::Route Class Reference

A basic route. More...

#include <route.h>

+ Inheritance diagram for FIFE::Route:
+ Collaboration diagram for FIFE::Route:

Public Member Functions

 Route (const Location &start, const Location &end)
 Constructor. More...
 
 ~Route ()
 Destructor. More...
 
void setRouteStatus (RouteStatusInfo status)
 Sets route status. More...
 
RouteStatusInfo getRouteStatus ()
 Returns route status. More...
 
void setStartNode (const Location &node)
 Sets the start location. More...
 
const LocationgetStartNode ()
 Returns the start location. More...
 
void setEndNode (const Location &node)
 Sets the target location. More...
 
const LocationgetEndNode ()
 Returns the target location. More...
 
const LocationgetCurrentNode ()
 Returns current location. More...
 
const LocationgetPreviousNode ()
 Returns previous location. More...
 
const LocationgetNextNode ()
 Returns next location. More...
 
bool walkToNextNode (int32_t step=1)
 Changes the position on the path. More...
 
bool reachedEnd ()
 Gets if the end of the path was achieved. More...
 
void setPath (const Path &path)
 Sets the path for the route. More...
 
Path getPath ()
 Returns the path. More...
 
void cutPath (uint32_t length=1)
 Cuts path after the given length. More...
 
void setReplanned (bool replanned)
 Sets the route to replanned. More...
 
bool isReplanned ()
 Gets if the route is replanned. More...
 
uint32_t getPathLength ()
 Returns the length of the path. More...
 
uint32_t getWalkedLength ()
 Returns the walked steps. More...
 
void setSessionId (int32_t id)
 Sets the session identifier. More...
 
int32_t getSessionId ()
 Returns the session identifier. More...
 
void setRotation (int32_t rotation)
 Sets the current rotation. More...
 
int32_t getRotation ()
 Returns the current rotation. More...
 
void setCostId (const std::string &cost)
 Sets cost identifier which should be used for pathfinding. More...
 
const std::string & getCostId ()
 Returns cost identifier which is used for pathfinding. More...
 
bool isMultiCell ()
 Gets if path is for a multi cell object. More...
 
void setOccupiedArea (const std::vector< ModelCoordinate > &area)
 Sets occupied coordinates for multi cell object. More...
 
const std::vector< ModelCoordinate > & getOccupiedArea ()
 Returns occupied coordinates for multi cell object. More...
 
std::vector< ModelCoordinategetOccupiedCells (int32_t rotation)
 Returns relative coordinates for multi cell object based on rotation. More...
 
int32_t getZStepRange ()
 Returns z-step range from object. More...
 
bool isAreaLimited ()
 
const std::list< std::string > getLimitedAreas ()
 
void setDynamicBlockerIgnored (bool ignore)
 Sets the route to ignore dynamic blocker. More...
 
bool isDynamicBlockerIgnored ()
 Gets if the route ignores dynamic blocker. More...
 
Path getBlockingPathLocations ()
 Returns the blocking locations of the path. More...
 
void setObject (Object *obj)
 Sets the object, needed for multi cell and z-step range. More...
 
ObjectgetObject ()
 Returns the object, needed for multi cell and z-step range. More...
 
- Public Member Functions inherited from FIFE::FifeClass
 FifeClass ()
 
virtual ~FifeClass ()
 
fifeid_t getFifeId ()
 Gets unique id of this instance inside the engine. More...
 

Private Types

typedef Path::iterator PathIterator
 path iterator More...
 

Private Attributes

RouteStatusInfo m_status
 search status More...
 
Location m_startNode
 start location More...
 
Location m_endNode
 end location More...
 
Path m_path
 path More...
 
PathIterator m_current
 current position on the path More...
 
uint32_t m_walked
 walked steps on the path More...
 
int32_t m_sessionId
 session id of the search More...
 
int32_t m_rotation
 current rotation More...
 
bool m_replanned
 is path replanned More...
 
bool m_ignoresBlocker
 ignores dynamic blocker More...
 
std::string m_costId
 used cost identifier More...
 
std::vector< ModelCoordinatem_area
 occupied cells by multicell object More...
 
Objectm_object
 pointer to multi object More...
 

Detailed Description

A basic route.

Holds the path and all related infos.

Definition at line 64 of file route.h.

Member Typedef Documentation

◆ PathIterator

typedef Path::iterator FIFE::Route::PathIterator
private

path iterator

Definition at line 255 of file route.h.

Constructor & Destructor Documentation

◆ Route()

FIFE::Route::Route ( const Location start,
const Location end 
)

Constructor.

Parameters
startA const reference to the start location.
endA const reference to the end/target location.

Definition at line 41 of file route.cpp.

◆ ~Route()

FIFE::Route::~Route ( )

Destructor.

Definition at line 54 of file route.cpp.

Member Function Documentation

◆ cutPath()

void FIFE::Route::cutPath ( uint32_t  length = 1)

Cuts path after the given length.

Parameters
lengthThe new length of the path.

Definition at line 181 of file route.cpp.

References m_current, m_endNode, m_path, m_replanned, m_startNode, m_status, m_walked, and FIFE::ROUTE_CREATED.

Referenced by FIFE::Instance::cancelMovement().

+ Here is the caller graph for this function:

◆ getBlockingPathLocations()

Path FIFE::Route::getBlockingPathLocations ( )

Returns the blocking locations of the path.

Only useful in case the blocking ignore flag is set.

Returns
A location list that contains all blocking locations of the path.

Definition at line 302 of file route.cpp.

References FIFE::Layer::cellContainsBlockingInstance(), and m_path.

◆ getCostId()

const std::string & FIFE::Route::getCostId ( )

Returns cost identifier which is used for pathfinding.

Returns
A const reference to the string that contains the identifier.

Definition at line 243 of file route.cpp.

References m_costId.

Referenced by FIFE::Instance::move(), FIFE::RoutePatherSearch::RoutePatherSearch(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().

+ Here is the caller graph for this function:

◆ getCurrentNode()

const Location & FIFE::Route::getCurrentNode ( )

Returns current location.

Returns
A const reference to the currently used location.

Definition at line 98 of file route.cpp.

References m_current, m_path, and m_startNode.

Referenced by FIFE::RoutePather::followRoute(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ getEndNode()

const Location & FIFE::Route::getEndNode ( )

Returns the target location.

Returns
A const reference to the end location.

Definition at line 94 of file route.cpp.

References m_endNode.

Referenced by FIFE::Instance::follow(), FIFE::Instance::processMovement(), and FIFE::RoutePather::solveRoute().

+ Here is the caller graph for this function:

◆ getLimitedAreas()

const std::list< std::string > FIFE::Route::getLimitedAreas ( )

Definition at line 286 of file route.cpp.

References FIFE::Object::getWalkableAreas(), and m_object.

Referenced by FIFE::RoutePather::solveRoute(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().

+ Here is the caller graph for this function:

◆ getNextNode()

const Location & FIFE::Route::getNextNode ( )

Returns next location.

Returns
A const reference to the next location.

Definition at line 121 of file route.cpp.

References m_current, m_path, and m_startNode.

◆ getObject()

Object * FIFE::Route::getObject ( )

Returns the object, needed for multi cell and z-step range.

Returns
A pointer to the object.

Definition at line 319 of file route.cpp.

References m_object.

◆ getOccupiedArea()

const std::vector< ModelCoordinate > & FIFE::Route::getOccupiedArea ( )

Returns occupied coordinates for multi cell object.

Returns
A const reference to a vector that contains the coordinates.

Definition at line 258 of file route.cpp.

References m_area.

Referenced by FIFE::RoutePatherSearch::RoutePatherSearch().

+ Here is the caller graph for this function:

◆ getOccupiedCells()

std::vector< ModelCoordinate > FIFE::Route::getOccupiedCells ( int32_t  rotation)

Returns relative coordinates for multi cell object based on rotation.

Parameters
rotationThe angle which is used to determine the occupied coordinates.
Returns
A const reference to a vector that contains the coordinates.

Definition at line 262 of file route.cpp.

References FIFE::Object::getMultiObjectCoordinates(), and m_object.

Referenced by FIFE::RoutePather::followRoute(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().

+ Here is the caller graph for this function:

◆ getPath()

Path FIFE::Route::getPath ( )

Returns the path.

Returns
The path which contains all steps.

Definition at line 177 of file route.cpp.

References m_path.

Referenced by FIFE::RoutePather::followRoute(), and FIFE::CellRenderer::render().

+ Here is the caller graph for this function:

◆ getPathLength()

uint32_t FIFE::Route::getPathLength ( )

Returns the length of the path.

Returns
The path length.

Definition at line 215 of file route.cpp.

References m_path.

Referenced by FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ getPreviousNode()

const Location & FIFE::Route::getPreviousNode ( )

Returns previous location.

Returns
A const reference to the previous location.

Definition at line 108 of file route.cpp.

References m_current, m_path, and m_startNode.

Referenced by FIFE::RoutePather::followRoute(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ getRotation()

int32_t FIFE::Route::getRotation ( )

Returns the current rotation.

Returns
The rotation as integer.

Definition at line 235 of file route.cpp.

References m_rotation.

Referenced by FIFE::RoutePather::followRoute(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ getRouteStatus()

RouteStatusInfo FIFE::Route::getRouteStatus ( )

Returns route status.

Returns
The seach status that is set.

Definition at line 63 of file route.cpp.

References m_status.

Referenced by FIFE::Instance::processMovement(), and FIFE::RoutePather::update().

+ Here is the caller graph for this function:

◆ getSessionId()

int32_t FIFE::Route::getSessionId ( )

Returns the session identifier.

Returns
A integer as identifier for the search session.

Definition at line 227 of file route.cpp.

References m_sessionId.

Referenced by FIFE::RoutePather::solveRoute(), and FIFE::ActionInfo::~ActionInfo().

+ Here is the caller graph for this function:

◆ getStartNode()

const Location & FIFE::Route::getStartNode ( )

Returns the start location.

Returns
A const reference to the start location.

Definition at line 78 of file route.cpp.

References m_startNode.

Referenced by FIFE::RoutePatherSearch::RoutePatherSearch(), and FIFE::RoutePather::solveRoute().

+ Here is the caller graph for this function:

◆ getWalkedLength()

uint32_t FIFE::Route::getWalkedLength ( )

Returns the walked steps.

Returns
The number of walked steps.

Definition at line 219 of file route.cpp.

References m_walked.

◆ getZStepRange()

int32_t FIFE::Route::getZStepRange ( )

Returns z-step range from object.

In case it is not limited -1 is returned.

Returns
The z-step range as int.

Definition at line 270 of file route.cpp.

References FIFE::Object::getZStepRange(), and m_object.

Referenced by FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().

+ Here is the caller graph for this function:

◆ isAreaLimited()

bool FIFE::Route::isAreaLimited ( )

Definition at line 277 of file route.cpp.

References FIFE::Object::getWalkableAreas(), and m_object.

Referenced by FIFE::RoutePather::solveRoute(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().

+ Here is the caller graph for this function:

◆ isDynamicBlockerIgnored()

bool FIFE::Route::isDynamicBlockerIgnored ( )

Gets if the route ignores dynamic blocker.

Returns
A boolean, if true the route ignores blocker, otherwise false.

Definition at line 298 of file route.cpp.

References m_ignoresBlocker.

Referenced by FIFE::RoutePatherSearch::RoutePatherSearch().

+ Here is the caller graph for this function:

◆ isMultiCell()

bool FIFE::Route::isMultiCell ( )

Gets if path is for a multi cell object.

Returns
A boolean, true if path is for multi cell, otherwise false.

Definition at line 247 of file route.cpp.

References FIFE::Object::isMultiObject(), and m_object.

Referenced by FIFE::RoutePather::followRoute(), and setPath().

+ Here is the caller graph for this function:

◆ isReplanned()

bool FIFE::Route::isReplanned ( )

Gets if the route is replanned.

Returns
A boolean, if true the route is replanned, otherwise false.

Definition at line 211 of file route.cpp.

References m_replanned.

Referenced by FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ reachedEnd()

bool FIFE::Route::reachedEnd ( )

Gets if the end of the path was achieved.

Returns
A boolean, if true the end is achieved, false otherwise.

Definition at line 156 of file route.cpp.

References m_current, and m_path.

◆ setCostId()

void FIFE::Route::setCostId ( const std::string &  cost)

Sets cost identifier which should be used for pathfinding.

Parameters
costA const reference to the string that contains the identifier.

Definition at line 239 of file route.cpp.

References m_costId.

Referenced by FIFE::RoutePather::createRoute(), and FIFE::Instance::move().

+ Here is the caller graph for this function:

◆ setDynamicBlockerIgnored()

void FIFE::Route::setDynamicBlockerIgnored ( bool  ignore)

Sets the route to ignore dynamic blocker.

Parameters
ignoreA boolean that indicates if true the route ignores blocker, otherwise false.

Definition at line 294 of file route.cpp.

References m_ignoresBlocker.

◆ setEndNode()

void FIFE::Route::setEndNode ( const Location node)

Sets the target location.

Parameters
nodeA const reference to the end location.

Definition at line 82 of file route.cpp.

References m_current, m_endNode, m_path, m_startNode, m_status, m_walked, and FIFE::ROUTE_CREATED.

Referenced by FIFE::RoutePather::followRoute(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ setObject()

void FIFE::Route::setObject ( Object obj)

Sets the object, needed for multi cell and z-step range.

Parameters
objA pointer to the object.

Definition at line 315 of file route.cpp.

References m_object.

Referenced by FIFE::Instance::follow(), FIFE::Instance::move(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ setOccupiedArea()

void FIFE::Route::setOccupiedArea ( const std::vector< ModelCoordinate > &  area)

Sets occupied coordinates for multi cell object.

Parameters
areaA const reference to a vector that contains the coordinates.

Definition at line 254 of file route.cpp.

References m_area.

Referenced by FIFE::Instance::follow(), FIFE::Instance::move(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ setPath()

void FIFE::Route::setPath ( const Path path)

Sets the path for the route.

Parameters
pathA const reference to the path.

Definition at line 163 of file route.cpp.

References isMultiCell(), m_current, m_endNode, m_path, m_replanned, m_startNode, m_status, m_walked, and FIFE::ROUTE_SOLVED.

Referenced by FIFE::SingleLayerSearch::calcPath(), and FIFE::MultiLayerSearch::calcPath().

+ Here is the caller graph for this function:

◆ setReplanned()

void FIFE::Route::setReplanned ( bool  replanned)

Sets the route to replanned.

Parameters
replannedA boolean that indicates if true the route is replanned, otherwise false.

Definition at line 207 of file route.cpp.

References m_replanned.

Referenced by FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ setRotation()

void FIFE::Route::setRotation ( int32_t  rotation)

Sets the current rotation.

Parameters
rotationThe rotation as integer.

Definition at line 231 of file route.cpp.

References m_rotation.

Referenced by FIFE::RoutePather::followRoute(), FIFE::Instance::move(), and FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ setRouteStatus()

◆ setSessionId()

void FIFE::Route::setSessionId ( int32_t  id)

Sets the session identifier.

Parameters
idA integer as identifier for the search session.

Definition at line 223 of file route.cpp.

References m_sessionId.

Referenced by FIFE::RoutePather::solveRoute().

+ Here is the caller graph for this function:

◆ setStartNode()

void FIFE::Route::setStartNode ( const Location node)

Sets the start location.

Parameters
nodeA const reference to the start location.

Definition at line 67 of file route.cpp.

References m_path, m_startNode, m_status, m_walked, and FIFE::ROUTE_CREATED.

Referenced by FIFE::Instance::processMovement().

+ Here is the caller graph for this function:

◆ walkToNextNode()

bool FIFE::Route::walkToNextNode ( int32_t  step = 1)

Changes the position on the path.

Changes the results of getCurrentNode(), getPreviousNode() and getPreviousNode().

Parameters
stepA integer that indicates how much steps should be walked along the path, default is one.
Returns
A boolean, true if the position could be changed, false otherwise e.g. at path end.

Definition at line 137 of file route.cpp.

References m_current, m_path, and m_walked.

Referenced by FIFE::RoutePather::followRoute().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_area

std::vector<ModelCoordinate> FIFE::Route::m_area
private

occupied cells by multicell object

Definition at line 291 of file route.h.

Referenced by getOccupiedArea(), and setOccupiedArea().

◆ m_costId

std::string FIFE::Route::m_costId
private

used cost identifier

Definition at line 288 of file route.h.

Referenced by getCostId(), and setCostId().

◆ m_current

PathIterator FIFE::Route::m_current
private

current position on the path

Definition at line 270 of file route.h.

Referenced by cutPath(), getCurrentNode(), getNextNode(), getPreviousNode(), reachedEnd(), setEndNode(), setPath(), and walkToNextNode().

◆ m_endNode

Location FIFE::Route::m_endNode
private

end location

Definition at line 264 of file route.h.

Referenced by cutPath(), getEndNode(), setEndNode(), and setPath().

◆ m_ignoresBlocker

bool FIFE::Route::m_ignoresBlocker
private

ignores dynamic blocker

Definition at line 285 of file route.h.

Referenced by isDynamicBlockerIgnored(), and setDynamicBlockerIgnored().

◆ m_object

Object* FIFE::Route::m_object
private

pointer to multi object

Definition at line 294 of file route.h.

Referenced by getLimitedAreas(), getObject(), getOccupiedCells(), getZStepRange(), isAreaLimited(), isMultiCell(), and setObject().

◆ m_path

◆ m_replanned

bool FIFE::Route::m_replanned
private

is path replanned

Definition at line 282 of file route.h.

Referenced by cutPath(), isReplanned(), setPath(), and setReplanned().

◆ m_rotation

int32_t FIFE::Route::m_rotation
private

current rotation

Definition at line 279 of file route.h.

Referenced by getRotation(), and setRotation().

◆ m_sessionId

int32_t FIFE::Route::m_sessionId
private

session id of the search

Definition at line 276 of file route.h.

Referenced by getSessionId(), and setSessionId().

◆ m_startNode

Location FIFE::Route::m_startNode
private

start location

Definition at line 261 of file route.h.

Referenced by cutPath(), getCurrentNode(), getNextNode(), getPreviousNode(), getStartNode(), setEndNode(), setPath(), and setStartNode().

◆ m_status

RouteStatusInfo FIFE::Route::m_status
private

search status

Definition at line 258 of file route.h.

Referenced by cutPath(), getRouteStatus(), setEndNode(), setPath(), setRouteStatus(), and setStartNode().

◆ m_walked

uint32_t FIFE::Route::m_walked
private

walked steps on the path

Definition at line 273 of file route.h.

Referenced by cutPath(), getWalkedLength(), setEndNode(), setPath(), setStartNode(), and walkToNextNode().


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