22 #ifndef FIFE_PATHFINDER_ROUTEPATHER
23 #define FIFE_PATHFINDER_ROUTEPATHER
35 #include "model/metamodel/abstractpather.h"
36 #include "model/structures/location.h"
37 #include "model/structures/map.h"
38 #include "util/structures/priorityqueue.h"
44 class RoutePatherSearch;
46 class RoutePather :
public AbstractPather {
51 RoutePather() : m_map(0), m_nextFreeSessionId(0), m_maxticks(1000) {
54 void setMap(Map* map);
55 int getNextLocation(
const Instance* instance,
const Location& target,
56 double distance_to_travel, Location& nextLocation,
57 Location& facingLocation,
int session_id=-1,
58 int priority = MEDIUM_PRIORITY);
76 bool cancelSession(
const int session_id);
83 bool addSearchSpace(SearchSpace* search_space);
90 SearchSpace* getSearchSpace(Layer *
const layer);
92 std::string getName()
const {
return "RoutePather"; };
94 typedef std::list<Location> Path;
95 typedef PriorityQueue<RoutePatherSearch*, int> SessionQueue;
96 typedef std::list<int> SessionList;
97 typedef std::map<int, Path> PathMap;
98 typedef std::map<Layer*, SearchSpace*> SearchSpaceMap;
99 typedef std::map<int, Location> LocationMap;
111 bool followPath(
const Instance* instance, Path& path,
double speed, Location& nextLocation, Location& facingLocation);
119 void addSessionId(
const int sessionId);
129 void makePlan(
const Instance *instance,
const Location& target,
int session_id,
int priority);
137 bool locationsEqual(
const Location &a,
const Location &b);
144 bool testStep(
const Instance *instance, Path& path);
153 bool sessionIdValid(
const int sessionId);
160 bool invalidateSessionId(
const int sessionId);
166 SessionQueue m_sessions;
169 SessionList m_registeredSessionIds;
175 LocationMap m_path_targets;
178 SearchSpaceMap m_searchspaces;
181 int m_nextFreeSessionId;