FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
multilayersearch.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2019 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_PATHFINDER_MULTILAYERSEARCH
23 #define FIFE_PATHFINDER_MULTILAYERSEARCH
24 
25 // Standard C++ library includes
26 
27 // 3rd party library includes
28 
29 // FIFE includes
30 // These includes are split up in two parts, separated by one empty line
31 // First block: files included from the FIFE root src directory
32 // Second block: files included from the same folder
34 
35 #include "routepathersearch.h"
36 
37 namespace FIFE {
38 
39  class CellCache;
40  class Route;
41  class Zone;
42 
46  public:
52  MultiLayerSearch(Route* route, const int32_t sessionId);
53 
57 
62  void updateSearch();
63 
68  void calcPath();
69 
70  private:
76  void createSearchFrontier(int32_t startInt, CellCache* cache);
77 
81  void calcPathStep();
82 
87 
92 
97 
104 
105  // A pointer to the start Zone.
107  // A pointer to the end Zone.
109 
115  int32_t m_destCoordInt;
119  int32_t m_next;
120 
122  std::vector<int32_t> m_spt;
124  std::vector<int32_t> m_sf;
126  std::vector<double> m_gCosts;
129 
131  std::list<Cell*> m_betweenTargets;
136  };
137 }
138 #endif
void createSearchFrontier(int32_t startInt, CellCache *cache)
Creates or resets the SearchFrontier.
CellCache * m_startCache
A pointer to the start CellCache.
std::list< Location > Path
A path is a list with locations. Each location holds the coordinate for one cell. ...
Definition: ipather.h:38
int32_t m_lastStartCoordInt
The last used start coordinate as an int32_t.
void calcPathStep()
Calculates path parts per layer.
A CellCache is an abstract depiction of one or a few layers and contains additional information...
Definition: cellcache.h:111
Location m_to
A location object representing where the search started.
MultiLayerSearch(Route *route, const int32_t sessionId)
Constructor.
int32_t m_destCoordInt
The destination coordinate as an int32_t.
MultiLayerSearch using A*.
std::vector< int32_t > m_sf
The search frontier.
A basic route.
Definition: route.h:64
void searchBetweenTargetsNeighbor()
Fetch targets from neighbor layers.
CellCache * m_endCache
A pointer to the end CellCache.
std::vector< int32_t > m_spt
The shortest path tree.
void searchBetweenTargetsMap()
Fetch targets from map.
Path m_path
Path to which all steps are added.
std::vector< double > m_gCosts
A table to hold the costs.
int32_t m_startCoordInt
The start coordinate as an int32_t.
RoutePatherSearch using A*.
int32_t m_next
The next coordinate to check out.
void updateSearch()
Updates the search.
PriorityQueue< int32_t, double > m_sortedFrontier
Priority queue to hold nodes on the sf in order.
Location m_from
A location object representing where the search ended.
std::list< Cell * > m_betweenTargets
List of targets that need to be solved to reach the real target.
int32_t m_lastDestCoordInt
The last used destination coordinate as an int32_t.
CellCache * m_currentCache
A pointer to the currently used CellCache.
A Zone is an abstract depiction of a CellCache or of a part of it.
Definition: cellcache.h:50
void calcPath()
Calculates final path.
bool m_foundLast
Indicates if last between target could be achieved.