-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapmarker.hpp
executable file
·97 lines (76 loc) · 1.83 KB
/
mapmarker.hpp
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef MAPMARKER_HPP
#define MAPMARKER_HPP
#include "sv_entity.hpp"
#include <vector>
class SpawnpointMarker :public Entity
{
public:
SpawnpointMarker(float x, float y, float r, team_type team);
~SpawnpointMarker();
int getCollisionEffect(void) { return collide_skip | collide_no_gravity | collide_immobile; }
float getMass(void) { return 0; }
team_type team;
};
//used to keep track of visited waypoints in graph traversals
enum visit_status
{
status_unvisited = 0,
status_enqueued,
status_visited
};
class WaypointMarker : public Entity
{
public:
WaypointMarker(float x, float y, float r);
int getCollisionEffect(void) { return collide_skip | collide_no_gravity | collide_immobile; }
bool isWaypointMarker() {return true;}
WaypointMarker *getRandomNeighbor();
//adding and removing are symmetric
void addEdgeTo(WaypointMarker *target);
void removeEdgeTo(WaypointMarker *target);
void calculateEdgeWeights();
//this is not symmetric!
bool hasEdgeTo(WaypointMarker *target) const;
inline void setVisitStatus(visit_status status)
{
visitStatus = status;
}
inline visit_status getVisitStatus() const
{
return visitStatus;
}
void deleteMe();
//wrapper for a waypoint marker's edge
struct Edge
{
WaypointMarker *target;
float length;
};
typedef std::vector<Edge> EdgePool;
inline EdgePool &getEdges()
{
return edgesOut;
}
inline float getWeight() const
{
return weight;
}
inline void setWeight(float newWeight)
{
weight = newWeight;
}
inline WaypointMarker *getParent() const
{
return parent;
}
inline void setParent(WaypointMarker *newParent)
{
parent = newParent;
}
private:
visit_status visitStatus;
float weight;
WaypointMarker *parent;
EdgePool edgesOut;
};
#endif //MAPMARKER_HPP