FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
ipather.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2006-2011 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_MODEL_IPATHER_H
23 #define FIFE_MODEL_IPATHER_H
24 
25 // Standard C++ library includes
26 #include <string>
27 
28 // 3rd party library includes
29 
30 // FIFE includes
31 // These includes are split up in two parts, separated by one empty line
32 // First block: files included from the FIFE root src directory
33 // Second block: files included from the same folder
34 
35 namespace FIFE {
36  class Location;
37  class Instance;
38  class Route;
39 
41  typedef std::list<Location> Path;
42 
43  enum PriorityType {
47  };
48 
49  class IPather {
50  public:
51  virtual ~IPather() {};
52 
60  virtual Route* createRoute(const Location& start, const Location& end, bool immediate = false, const std::string& cost_id = "") = 0;
61 
69  virtual bool solveRoute(Route* route, int32_t priority = MEDIUM_PRIORITY, bool immediate = false) = 0;
70 
79  virtual bool followRoute(const Location& current, Route* route, double speed, Location& nextLocation) = 0;
80 
88  virtual void update() = 0;
89 
99  virtual bool cancelSession(const int32_t sessionId) = 0;
100 
104  virtual void setMaxTicks(int32_t ticks) = 0;
105 
109  virtual int32_t getMaxTicks() = 0;
110 
113  virtual std::string getName() const = 0;
114  };
115 }
116 
117 #endif
std::list< Location > Path
A path is a list with locations. Each location holds the coordinate for one cell. ...
Definition: ipather.h:38
virtual bool solveRoute(Route *route, int32_t priority=MEDIUM_PRIORITY, bool immediate=false)=0
Solves the route to create a path.
virtual int32_t getMaxTicks()=0
Returns maximal ticks (update steps) to solve routes.
virtual ~IPather()
Definition: ipather.h:51
virtual void update()=0
Updates the pather (should it need updating).
virtual void setMaxTicks(int32_t ticks)=0
Sets maximal ticks (update steps) to solve routes.
A basic route.
Definition: route.h:64
virtual std::string getName() const =0
Gets the name of this pather.
PriorityType
Definition: ipather.h:43
virtual bool cancelSession(const int32_t sessionId)=0
Cancels a given session.
virtual bool followRoute(const Location &current, Route *route, double speed, Location &nextLocation)=0
Follows the path of the route.
virtual Route * createRoute(const Location &start, const Location &end, bool immediate=false, const std::string &cost_id="")=0
Creates a route between the start and end location that needs be solved.