-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCIntel.h
76 lines (60 loc) · 2.02 KB
/
CIntel.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef INTEL_H
#define INTEL_H
#include <vector>
#include <list>
#include <map>
#include "headers/Defines.h"
#include "headers/HEngine.h"
#include "CMilitary.h"
#include "CUnitTable.h"
#include "CCataloguer.h"
class AIClasses;
class CUnit;
// NOTE: actually it is a simple StrategyManager
class CIntel {
public:
typedef std::map<MilitaryGroupBehaviour, std::vector<CategoryMatcher> > TargetCategoryMap;
CIntel(AIClasses *ai);
bool strategyTechUp;
CCataloguer enemies;
// all enemies sorted by requested categories
std::multimap<float, unitCategory> roulette; // <weight, unit_cat>
// containts counter-enemy unit categories sorted by weight
std::list<unitCategory> allowedFactories;
// contains allowed factories for current map, and also preferable
// order of their appearance
TargetCategoryMap targets;
// contains lists of targets per each military group behaviour
void update(int frame);
void init();
bool enemyInbound();
float3 getEnemyVector();
unsigned int getEnemyCount(unitCategory c) { return enemyCounter[c]; }
void onEnemyCreated(int enemy);
void onEnemyDestroyed(int enemy, int attacker);
protected:
AIClasses *ai;
private:
bool initialized;
unsigned int totalEnemyCount;
// total number of enemy mobile military units
unsigned int totalCounterCount;
// total number of potential counter-enemy units
float3 enemyvector;
// general direction towards enemy
std::map<unitCategory, unsigned int, UnitCategoryCompare> enemyCounter;
// counters for enemy mobile military units per category
std::map<unitCategory, unsigned int, UnitCategoryCompare> counterCounter;
// counters for counter-enemy units per category
std::vector<unitCategory> selector;
// list of unit categories which are tracked by enemy counters
/* Reset enemy unit counters */
void resetCounters();
/* Count enemy units */
void updateCounters(unitCategory c);
/* Get unit category counterpart (can be implemented via map) */
unitCategory counter(unitCategory ecats);
void updateRoulette();
void updateEnemyVector();
};
#endif