-
Notifications
You must be signed in to change notification settings - Fork 1
/
TeleportPath.h
45 lines (36 loc) · 1.21 KB
/
TeleportPath.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
//////////////////////////////////////////////////////////////////////
// TeleportPath.h
//
// Diablo II game path finding(teleport) algorithms.
//
// I must give credits to both Niren7 and Ninjai, their code helped me
// start this class to say the least.
//
// Ustc_tweeg also helped me a lot on completing this algorithm.
//
// Written by Abin([email protected])
// Sep 10th, 2004
////////////////////////////////////////////////////////////////////////
#ifndef __TELEPORTPATH_H__
#define __TELEPORTPATH_H__
#include <windows.h>
class CTeleportPath
{
public:
CTeleportPath(WORD** pCollisionMap, int cx, int cy);
virtual ~CTeleportPath();
DWORD FindTeleportPath(POINT ptStart, POINT ptEnd, LPPOINT lpBuffer, DWORD dwMaxCount); // Calculate path
private:
BOOL DumpDistanceTable(LPCSTR lpszFilePath) const;
static int GetRedundancy(const LPPOINT lpPath, DWORD dwMaxCount, const POINT& pos);
void Block(POINT pos, int nRange);
BOOL GetBestMove(POINT& rResult, int nAdjust = 2);
BOOL MakeDistanceTable();
BOOL IsValidIndex(int x, int y) const;
WORD** m_ppTable; // Distance table
POINT m_ptStart;
POINT m_ptEnd;
int m_nCX;
int m_nCY;
};
#endif // __TELEPORTPATH_H__