-
Notifications
You must be signed in to change notification settings - Fork 8
/
CThreatMap.h
59 lines (48 loc) · 1.32 KB
/
CThreatMap.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef THREATMAP_H
#define THREATMAP_H
#include "headers/Defines.h"
#include "headers/HEngine.h"
class AIClasses;
class CGroup;
// TODO: convert into flags?
enum ThreatMapType {
TMT_NONE = 0,
TMT_AIR,
TMT_SURFACE,
TMT_UNDERWATER,
TMT_LAST
};
class CThreatMap {
public:
CThreatMap(AIClasses* ai);
~CThreatMap();
void update(int frame);
float getThreat(float3 center, float radius, ThreatMapType type = TMT_SURFACE);
float getThreat(const float3& center, float radius, CGroup* group);
const float* getMap(ThreatMapType);
bool switchDebugMode();
bool isInBounds(int x, int z) { return (x >= 0 && z >= 0 && x < X && z < Z); }
void checkInBounds(int& x, int& z);
protected:
AIClasses* ai;
private:
int X, Z;
// width & height of threat map (in pathgraph resolution)
int lastUpdateFrame;
// not very helpful for now; will be really used when threatmap
// is shared between allied AIs
ThreatMapType drawMap;
// current threat map to visualize
std::map<ThreatMapType, float> maxPower;
// max threat per map
std::map<ThreatMapType, float*> maps;
// threatmap data
#if !defined(BUILDING_AI_FOR_SPRING_0_81_2)
std::map<ThreatMapType, int> handles;
// for visual debugging purposes
#endif
float gauss(float x, float sigma, float mu);
void reset();
void visualizeMap(ThreatMapType type = TMT_SURFACE);
};
#endif