22 #ifndef FIFE_PATHFINDER_ROUTEPATHER
23 #define FIFE_PATHFINDER_ROUTEPATHER
35 #include "model/metamodel/ipather.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 IPather {
51 RoutePather() : m_map(0), m_nextFreeSessionId(0), m_maxticks(1000) {
54 void setMap(Map* map);
55 int32_t getNextLocation(
const Instance* instance,
const Location& target,
56 double distance_to_travel, Location& nextLocation,
57 Location& facingLocation, int32_t session_id=-1,
58 int32_t priority = MEDIUM_PRIORITY);
76 bool cancelSession(
const int32_t 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*, int32_t> SessionQueue;
96 typedef std::list<int32_t> SessionList;
97 typedef std::map<int32_t, Path> PathMap;
98 typedef std::map<Layer*, SearchSpace*> SearchSpaceMap;
99 typedef std::map<int32_t, Location> LocationMap;
111 bool followPath(
const Instance* instance, Path& path,
double speed, Location& nextLocation, Location& facingLocation);
119 void addSessionId(
const int32_t sessionId);
129 void makePlan(
const Instance *instance,
const Location& target, int32_t session_id, int32_t priority);
134 int32_t makeSessionId();
137 bool locationsEqual(
const Location &a,
const Location &b);
144 bool testStep(
const Instance *instance, Path& path);
153 bool sessionIdValid(
const int32_t sessionId);
160 bool invalidateSessionId(
const int32_t sessionId);
166 SessionQueue m_sessions;
169 SessionList m_registeredSessionIds;
175 LocationMap m_path_targets;
178 SearchSpaceMap m_searchspaces;
181 int32_t m_nextFreeSessionId;
credit to phoku for his NodeDisplay example which the visitor code is adapted from ( he coded the qua...