BWAPI
|
00001 #ifndef __AGENTMANAGER_H__ 00002 #define __AGENTMANAGER_H__ 00003 00004 #include <BWAPI.h> 00005 #include "BaseAgent.h" 00006 00007 using namespace BWAPI; 00008 using namespace std; 00009 00019 class AgentManager { 00020 00021 private: 00022 vector<BaseAgent*> agents; 00023 AgentManager(); 00024 static AgentManager* instance; 00025 static bool instanceFlag; 00026 int lastCallFrame; 00027 00028 public: 00029 ~AgentManager(); 00030 00032 static AgentManager* getInstance(); 00033 00036 void addAgent(Unit* unit); 00037 00041 void removeAgent(Unit* unit); 00042 00044 void morphDrone(Unit* unit); 00045 00047 void computeActions(); 00048 00050 int getNoWorkers(); 00051 00053 int noMiningWorkers(); 00054 00056 BaseAgent* findClosestFreeWorker(TilePosition pos); 00057 00059 bool isAnyAgentRepairingThisAgent(BaseAgent* repairedAgent); 00060 00062 int countNoUnits(UnitType type); 00063 00065 int countNoBases(); 00066 00068 vector<BaseAgent*> getAgents(); 00069 00071 int size(); 00072 00075 BaseAgent* getAgent(int unitID); 00076 00078 BaseAgent* getAgent(UnitType type); 00079 00081 void requestOverlord(TilePosition pos); 00082 00084 BaseAgent* getClosestAgent(TilePosition pos, UnitType type); 00085 00088 BaseAgent* getClosestBase(TilePosition pos); 00089 00092 TilePosition getClosestDetector(TilePosition startPos); 00093 00095 bool unitsInArea(TilePosition pos, int tileWidth, int tileHeight, int unitID); 00096 00098 void cleanup(); 00099 }; 00100 00101 #endif