FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
A basic route. More...
#include <route.h>
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 Location & | getStartNode () |
Returns the start location. More... | |
void | setEndNode (const Location &node) |
Sets the target location. More... | |
const Location & | getEndNode () |
Returns the target location. More... | |
const Location & | getCurrentNode () |
Returns current location. More... | |
const Location & | getPreviousNode () |
Returns previous location. More... | |
const Location & | getNextNode () |
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< ModelCoordinate > | getOccupiedCells (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... | |
Object * | getObject () |
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< ModelCoordinate > | m_area |
occupied cells by multicell object More... | |
Object * | m_object |
pointer to multi object More... | |
|
private |
void FIFE::Route::cutPath | ( | uint32_t | length = 1 | ) |
Cuts path after the given length.
length | The 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().
Path FIFE::Route::getBlockingPathLocations | ( | ) |
Returns the blocking locations of the path.
Only useful in case the blocking ignore flag is set.
Definition at line 302 of file route.cpp.
References FIFE::Layer::cellContainsBlockingInstance(), and m_path.
const std::string & FIFE::Route::getCostId | ( | ) |
Returns cost identifier which is used for pathfinding.
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().
const Location & FIFE::Route::getCurrentNode | ( | ) |
Returns current 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().
const Location & FIFE::Route::getEndNode | ( | ) |
Returns the target location.
Definition at line 94 of file route.cpp.
References m_endNode.
Referenced by FIFE::Instance::follow(), FIFE::Instance::processMovement(), and FIFE::RoutePather::solveRoute().
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().
const Location & FIFE::Route::getNextNode | ( | ) |
Returns next location.
Definition at line 121 of file route.cpp.
References m_current, m_path, and m_startNode.
Object * FIFE::Route::getObject | ( | ) |
const std::vector< ModelCoordinate > & FIFE::Route::getOccupiedArea | ( | ) |
Returns occupied coordinates for multi cell object.
Definition at line 258 of file route.cpp.
References m_area.
Referenced by FIFE::RoutePatherSearch::RoutePatherSearch().
std::vector< ModelCoordinate > FIFE::Route::getOccupiedCells | ( | int32_t | rotation | ) |
Returns relative coordinates for multi cell object based on rotation.
rotation | The angle which is used to determine the occupied 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().
Path FIFE::Route::getPath | ( | ) |
Returns the path.
Definition at line 177 of file route.cpp.
References m_path.
Referenced by FIFE::RoutePather::followRoute(), and FIFE::CellRenderer::render().
uint32_t FIFE::Route::getPathLength | ( | ) |
Returns the length of the path.
Definition at line 215 of file route.cpp.
References m_path.
Referenced by FIFE::Instance::processMovement().
const Location & FIFE::Route::getPreviousNode | ( | ) |
Returns 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().
int32_t FIFE::Route::getRotation | ( | ) |
Returns the current rotation.
Definition at line 235 of file route.cpp.
References m_rotation.
Referenced by FIFE::RoutePather::followRoute(), and FIFE::Instance::processMovement().
RouteStatusInfo FIFE::Route::getRouteStatus | ( | ) |
Returns route status.
Definition at line 63 of file route.cpp.
References m_status.
Referenced by FIFE::Instance::processMovement(), and FIFE::RoutePather::update().
int32_t FIFE::Route::getSessionId | ( | ) |
Returns the session identifier.
Definition at line 227 of file route.cpp.
References m_sessionId.
Referenced by FIFE::RoutePather::solveRoute(), and FIFE::ActionInfo::~ActionInfo().
const Location & FIFE::Route::getStartNode | ( | ) |
Returns the start location.
Definition at line 78 of file route.cpp.
References m_startNode.
Referenced by FIFE::RoutePatherSearch::RoutePatherSearch(), and FIFE::RoutePather::solveRoute().
uint32_t FIFE::Route::getWalkedLength | ( | ) |
int32_t FIFE::Route::getZStepRange | ( | ) |
Returns z-step range from object.
In case it is not limited -1 is returned.
Definition at line 270 of file route.cpp.
References FIFE::Object::getZStepRange(), and m_object.
Referenced by FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().
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().
bool FIFE::Route::isDynamicBlockerIgnored | ( | ) |
Gets if the route ignores dynamic blocker.
Definition at line 298 of file route.cpp.
References m_ignoresBlocker.
Referenced by FIFE::RoutePatherSearch::RoutePatherSearch().
bool FIFE::Route::isMultiCell | ( | ) |
Gets if path is for a multi cell object.
Definition at line 247 of file route.cpp.
References FIFE::Object::isMultiObject(), and m_object.
Referenced by FIFE::RoutePather::followRoute(), and setPath().
bool FIFE::Route::isReplanned | ( | ) |
Gets if the route is replanned.
Definition at line 211 of file route.cpp.
References m_replanned.
Referenced by FIFE::Instance::processMovement().
bool FIFE::Route::reachedEnd | ( | ) |
void FIFE::Route::setCostId | ( | const std::string & | cost | ) |
Sets cost identifier which should be used for pathfinding.
cost | A 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().
void FIFE::Route::setDynamicBlockerIgnored | ( | bool | ignore | ) |
Sets the route to ignore dynamic blocker.
ignore | A boolean that indicates if true the route ignores blocker, otherwise false. |
Definition at line 294 of file route.cpp.
References m_ignoresBlocker.
void FIFE::Route::setEndNode | ( | const Location & | node | ) |
Sets the target location.
node | A 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().
void FIFE::Route::setObject | ( | Object * | obj | ) |
Sets the object, needed for multi cell and z-step range.
obj | A 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().
void FIFE::Route::setOccupiedArea | ( | const std::vector< ModelCoordinate > & | area | ) |
Sets occupied coordinates for multi cell object.
area | A 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().
void FIFE::Route::setPath | ( | const Path & | path | ) |
Sets the path for the route.
path | A 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().
void FIFE::Route::setReplanned | ( | bool | replanned | ) |
Sets the route to replanned.
replanned | A 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().
void FIFE::Route::setRotation | ( | int32_t | rotation | ) |
Sets the current rotation.
rotation | The 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().
void FIFE::Route::setRouteStatus | ( | RouteStatusInfo | status | ) |
Sets route status.
status | The seach status that should be set. |
Definition at line 57 of file route.cpp.
References m_status.
Referenced by FIFE::SingleLayerSearch::calcPath(), FIFE::MultiLayerSearch::calcPath(), FIFE::MultiLayerSearch::calcPathStep(), FIFE::RoutePather::createRoute(), FIFE::MultiLayerSearch::MultiLayerSearch(), FIFE::RoutePatherSearch::RoutePatherSearch(), FIFE::RoutePather::solveRoute(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().
void FIFE::Route::setSessionId | ( | int32_t | id | ) |
Sets the session identifier.
id | A integer as identifier for the search session. |
Definition at line 223 of file route.cpp.
References m_sessionId.
Referenced by FIFE::RoutePather::solveRoute().
void FIFE::Route::setStartNode | ( | const Location & | node | ) |
Sets the start location.
node | A 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().
bool FIFE::Route::walkToNextNode | ( | int32_t | step = 1 | ) |
Changes the position on the path.
Changes the results of getCurrentNode(), getPreviousNode() and getPreviousNode().
step | A integer that indicates how much steps should be walked along the path, default is one. |
Definition at line 137 of file route.cpp.
References m_current, m_path, and m_walked.
Referenced by FIFE::RoutePather::followRoute().
|
private |
occupied cells by multicell object
Definition at line 291 of file route.h.
Referenced by getOccupiedArea(), and setOccupiedArea().
|
private |
used cost identifier
Definition at line 288 of file route.h.
Referenced by getCostId(), and setCostId().
|
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().
|
private |
end location
Definition at line 264 of file route.h.
Referenced by cutPath(), getEndNode(), setEndNode(), and setPath().
|
private |
ignores dynamic blocker
Definition at line 285 of file route.h.
Referenced by isDynamicBlockerIgnored(), and setDynamicBlockerIgnored().
|
private |
pointer to multi object
Definition at line 294 of file route.h.
Referenced by getLimitedAreas(), getObject(), getOccupiedCells(), getZStepRange(), isAreaLimited(), isMultiCell(), and setObject().
|
private |
path
Definition at line 267 of file route.h.
Referenced by cutPath(), getBlockingPathLocations(), getCurrentNode(), getNextNode(), getPath(), getPathLength(), getPreviousNode(), reachedEnd(), setEndNode(), setPath(), setStartNode(), and walkToNextNode().
|
private |
is path replanned
Definition at line 282 of file route.h.
Referenced by cutPath(), isReplanned(), setPath(), and setReplanned().
|
private |
current rotation
Definition at line 279 of file route.h.
Referenced by getRotation(), and setRotation().
|
private |
session id of the search
Definition at line 276 of file route.h.
Referenced by getSessionId(), and setSessionId().
|
private |
start location
Definition at line 261 of file route.h.
Referenced by cutPath(), getCurrentNode(), getNextNode(), getPreviousNode(), getStartNode(), setEndNode(), setPath(), and setStartNode().
|
private |
search status
Definition at line 258 of file route.h.
Referenced by cutPath(), getRouteStatus(), setEndNode(), setPath(), setRouteStatus(), and setStartNode().
|
private |
walked steps on the path
Definition at line 273 of file route.h.
Referenced by cutPath(), getWalkedLength(), setEndNode(), setPath(), setStartNode(), and walkToNextNode().