This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
GPS.inc
80 lines (62 loc) · 2.75 KB
/
GPS.inc
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#if defined _inc_gps
#undef _inc_gps
#endif
#if defined _gps_included
#endinput
#endif
#define _gps_included
const MapNode:INVALID_MAP_NODE_ID = MapNode:-1;
const Path:INVALID_PATH_ID = Path:-1;
const Connection:INVALID_CONNECTION_ID = Connection:-1;
enum _:GPS_ERROR
{
GPS_ERROR_NONE = 0,
GPS_ERROR_INVALID_PARAMS = -1,
GPS_ERROR_INVALID_PATH = -2,
GPS_ERROR_INVALID_NODE = -3,
GPS_ERROR_INVALID_CONNECTION = -4,
GPS_ERROR_INTERNAL = -5
}
native CreateMapNode(Float:x, Float:y, Float:z, &MapNode:nodeid);
native DestroyMapNode(MapNode:nodeid);
native bool:IsValidMapNode(MapNode:nodeid);
native GetMapNodePos(MapNode:nodeid, &Float:x, &Float:y, &Float:z);
native CreateConnection(MapNode:source, MapNode:target, &Connection:connectionid);
native DestroyConnection(Connection:connectionid);
native GetConnectionSource(Connection:connectionid, &MapNode:nodeid);
native GetConnectionTarget(Connection:connectionid, &MapNode:nodeid);
native GetMapNodeConnectionCount(MapNode:nodeid, &count);
native GetMapNodeConnection(MapNode:nodeid, index, &Connection:connectionid);
native GetConnectionBetweenMapNodes(MapNode:source, MapNode:target, &Connection:connectionid);
native GetDistanceBetweenMapNodes(MapNode:first, MapNode:second, &Float:distance);
native GetAngleBetweenMapNodes(MapNode:first, MapNode:second, &Float:angle);
native GetMapNodeDistanceFromPoint(MapNode:nodeid, Float:x, Float:y, Float:z, &Float:distance);
native GetMapNodeAngleFromPoint(MapNode:nodeid, Float:x, Float:y, &Float:angle);
native GetClosestMapNodeToPoint(Float:x, Float:y, Float:z, &MapNode:nodeid, MapNode:ignorednode = INVALID_MAP_NODE_ID);
native GetHighestMapNodeID();
native GetRandomMapNode(&MapNode:nodeid);
native SaveMapNodesToFile(const filename[]);
native FindPath(MapNode:source, MapNode:target, &Path:pathid);
native FindPathThreaded(MapNode:source, MapNode:target, const callback[], const format[] = "", {Float, _}:...);
native bool:IsValidPath(Path:pathid);
native GetPathSize(Path:pathid, &size);
native GetPathLength(Path:pathid, &Float:length);
native GetPathNode(Path:pathid, index, &MapNode:nodeid);
native GetPathNodeIndex(Path:pathid, MapNode:nodeid, &index);
native DestroyPath(Path:pathid);
#if defined _PawnPlus_included
stock Task:FindPathAsync(MapNode:source, MapNode:target)
{
new Task:task = task_new();
if (FindPathThreaded(source, target, "FindPathAsyncResponse", "i", _:task) != GPS_ERROR_NONE)
{
task_set_error_ticks(task, amx_err_exit, 0);
}
return task;
}
forward public FindPathAsyncResponse(Path:path, Task:task);
public FindPathAsyncResponse(Path:path, Task:task)
{
task_set_result(task, _:path);
}
#endif