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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
// _____________________________________________________
//
// RAI - Skirmish AI for Spring
// Author: Reth / Michael Vadovszki
// _____________________________________________________
#ifndef RAI_UNIT_MANAGER_H
#define RAI_UNIT_MANAGER_H
struct sRAIGroup;
class cUnitManager;
#include "RAI.h"
using std::map;
using std::set;
struct sRAIGroupMilitary
{
sRAIGroupMilitary()
{
count=0;
};
float3 RallyPoint;
float3 ScoutPoint;
int count;
};
struct sRAIGroupConstruct
{
sRAIGroupConstruct()
{
BuildSpeed=0.0f;
count=0;
};
float BuildSpeed;
int count;
};
struct sRAIGroup
{
sRAIGroup(int Index);
~sRAIGroup();
int index;
map<int,UnitInfo*> Units;
map<int,EnemyInfo*> Enemies;
sRAIGroupMilitary* M;
sRAIGroupConstruct* C;
// UnitInfo* Radar;
// UnitInfo* Jammer;
// UnitInfo* AntiMis;
// UnitInfo* Engineer;
};
#define SCOUT_POSITON_LIST_SIZE 20
#define RAI_GROUP_SIZE 25
class cUnitManager
{
public:
cUnitManager(IAICallback* callback, cRAI* Global);
~cUnitManager() {};
void UnitFinished(int unit,UnitInfo *U);
void UnitDestroyed(int unit,UnitInfo *U);
void UnitIdle(int unit,UnitInfo *U);
void EnemyEnterLOS(int enemy,EnemyInfo *E);
void EnemyEnterRadar(int enemy,EnemyInfo *E);
bool UnitMoveFailed(int unit,UnitInfo *U);
void UpdateGroupSize();
bool ActiveAttackOrders();
void GroupAddUnit(int unit, UnitInfo* U, sRAIGroup* group);
void GroupRemoveUnit(int unit, UnitInfo* U);
void GroupAddEnemy(int enemy, EnemyInfo *E, sRAIGroup* group);
void GroupRemoveEnemy(int enemy, EnemyInfo *E, sRAIGroup* group);
void GroupResetRallyPoint(sRAIGroup* group);
// bool AssaultScouts;
sRAIGroup* Group[RAI_GROUP_SIZE];
// sRAIGroup* Commander;
int GroupSize;
private:
bool AttackOrders;
int MaxGroupMSize;
void Assign(int unit,UnitInfo *U);
void SendattackGroups();
map<int,UnitInfo*> UAssault; // key = unit id
map<int,UnitInfo*> USuicide;
set<int> USupport;
struct sTransportUnitInfo
{
sTransportUnitInfo(const UnitDef *unitdef) { ud=unitdef; AssistID=-1; };
const UnitDef *ud;
int AssistID;
};
typedef pair<int,sTransportUnitInfo> itPair;
map<int,sTransportUnitInfo> UTrans;
struct sScoutPosition
{
int ScoutID;
float3 position;
};
sScoutPosition *SL[SCOUT_POSITON_LIST_SIZE];
int SLSize;
struct sScoutUnitInfo
{
sScoutUnitInfo() {
ScoutLocAssigned=false;
SL = NULL;
};
sScoutPosition *SL;
bool ScoutLocAssigned;
};
typedef pair<int,sScoutUnitInfo> isPair;
map<int,sScoutUnitInfo> UScout;
IAICallback *cb;
cRAI* G;
cLogFile *l;
};
#endif
|