-
Notifications
You must be signed in to change notification settings - Fork 1
/
epathfindtask.h
executable file
·45 lines (41 loc) · 1.47 KB
/
epathfindtask.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef EPATHFINDTASK_H
#define EPATHFINDTASK_H
#include "engine/etask.h"
#include "engine/thread/ethreadtile.h"
#include "engine/thread/ethreaddata.h"
class ePathFindTask : public eTask {
public:
using ePath = std::vector<eOrientation>;
using eTileGetter = std::function<eThreadTile*(eThreadBoard&)>;
using eTileChecker = std::function<bool(eThreadTile*)>;
using eFinishFunc = std::function<void(const ePath&)>;
using eFailFunc = std::function<void()>;
using eTileDistance = std::function<int(eTileBase* const)>;
ePathFindTask(const eTileGetter& startTile,
const stdsptr<eWalkableObject>& tileWalkable,
const eTileChecker& endTileFunc,
const eFinishFunc& finishFunc,
const eFailFunc& failFunc,
const bool onlyDiagonal,
const int range,
const eTileDistance& distance = nullptr,
const eTileGetter& endTile = nullptr,
const bool findAll = false);
protected:
void run(eThreadBoard& data);
void finish();
private:
const eTileGetter mStartTile;
const eTileGetter mEndTile;
const stdsptr<eWalkableObject> mTileWalkable;
const eTileChecker mEndTileFunc;
const eFinishFunc mFinish;
const eFailFunc mFailFunc;
const bool mOnlyDiagonal;
const int mRange;
const eTileDistance mDistance;
const bool mFindAll;
bool mR{false};
ePath mPath;
};
#endif // EPATHFINDTASK_H