1 #ifndef KAIK_THREATMAP_HDR 2 #define KAIK_THREATMAP_HDR 3 4 #include <map> 5 #include <vector> 6 7 struct AIClasses; 8 9 class CThreatMap { 10 public: 11 CR_DECLARE(CThreatMap) 12 13 CThreatMap(AIClasses* ai); 14 ~CThreatMap(); 15 16 void PostLoad(); 17 void Update(); 18 19 void EnemyCreated(int); 20 void EnemyFinished(int); 21 void EnemyDamaged(int, int); 22 void EnemyDestroyed(int, int); 23 GetAverageThreat()24 float GetAverageThreat() const { return (currAvgThreat + 1.0f); } 25 float ThreatAtThisPoint(const float3&) const; 26 GetThreatArray()27 float* GetThreatArray() { return &threatCellsRaw[0]; } GetThreatMapWidth()28 int GetThreatMapWidth() const { return width; } GetThreatMapHeight()29 int GetThreatMapHeight() const { return height; } 30 31 void ToggleVisOverlay(); 32 33 private: 34 struct EnemyUnit { 35 bool operator < (const EnemyUnit& e) const { 36 return (id < e.id); 37 } 38 39 int id; 40 float3 pos; 41 float threat; 42 float range; 43 }; 44 45 void AddEnemyUnit(const EnemyUnit&, const float s); 46 void DelEnemyUnit(const EnemyUnit&); 47 float GetEnemyUnitThreat(const EnemyUnit&) const; 48 49 float currAvgThreat; 50 float currMaxThreat; 51 float currSumThreat; 52 53 int area; 54 int width; 55 int height; 56 57 int threatMapTexID; 58 59 std::map<int, EnemyUnit> enemyUnits; 60 std::vector<float> threatCellsRaw; 61 std::vector<float> threatCellsVis; 62 63 AIClasses* ai; 64 }; 65 66 #endif 67