| 1 |
#ifndef HEADER_FINDERALG_H |
| 2 |
#define HEADER_FINDERALG_H |
| 3 |
|
| 4 |
class V2; |
| 5 |
class Unit; |
| 6 |
|
| 7 |
#include "Dir.h" |
| 8 |
#include "FinderField.h" |
| 9 |
#include "FinderPlace.h" |
| 10 |
|
| 11 |
#include <deque> |
| 12 |
|
| 13 |
/** |
| 14 |
* Algorithm to find shortest path. |
| 15 |
*/ |
| 16 |
class FinderAlg { |
| 17 |
private: |
| 18 |
const Unit *m_unit; |
| 19 |
FinderField m_closed; |
| 20 |
std::deque<FinderPlace> m_fifo; |
| 21 |
private: |
| 22 |
void pushNext(const FinderPlace &parent, const V2 &shift); |
| 23 |
bool isInRect(const V2 &rectLoc, int w, int h, const V2 &dest) const; |
| 24 |
bool tryPlace(const FinderPlace &place) const; |
| 25 |
public: |
| 26 |
FinderAlg(int w, int h); |
| 27 |
Dir::eDir findDir(const Unit *unit, const V2 &dest); |
| 28 |
}; |
| 29 |
|
| 30 |
#endif |