File: PathFinder.h

package info (click to toggle)
spring 106.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 55,260 kB
  • sloc: cpp: 543,946; ansic: 44,800; python: 12,575; java: 12,201; awk: 5,889; sh: 1,796; asm: 1,546; xml: 655; perl: 405; php: 211; objc: 194; makefile: 76; sed: 2
file content (60 lines) | stat: -rw-r--r-- 1,281 bytes parent folder | download | duplicates (7)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef KAIK_PATHFINDER_HDR
#define KAIK_PATHFINDER_HDR

#include <string>
#include <vector>
#include "MicroPather.h"

struct AIClasses;
namespace springLegacyAI {
	struct MoveData;
} // namespace springLegacyAI
using namespace NSMicroPather;

typedef std::vector<float3> F3Vec;

class CPathFinder: public Graph {
public:
	CPathFinder(AIClasses* ai);
	~CPathFinder();

	void Init();
	void* XY2Node(int x, int y);
	void Node2XY(void* node, int* x, int* y);
	float3 Node2Pos(void* node);
	void* Pos2Node(float3 pos);

	unsigned Checksum();
	float MakePath(F3Vec& posPath, float3& startPos, float3& endPos, int radius);
	float FindBestPath(F3Vec& posPath, float3& startPos, float myMaxRange, F3Vec& possibleTargets);
	float FindBestPathToRadius(F3Vec& posPath, float3& startPos, float radiusAroundTarget, const float3& target);

	void CreateDefenseMatrix();

	bool IsPositionReachable(const MoveData*, const float3&) const;


	MicroPather* micropather;
	bool* TestMoveArray;
	std::vector<bool*> MoveArrays;
	int NumOfMoveTypes;

	std::vector<float> SlopeMap;
	std::vector<float> HeightMap;
	int PathMapXSize;
	int PathMapYSize;
	int totalcells;
	double AverageHeight;

private:
	std::vector<void*> path;
	float totalcost;

	int resScale;
	int squareSize;

	AIClasses* ai;
};


#endif