BWAPI
BasicAIModule/include/Squad.h
Go to the documentation of this file.
00001 #pragma once
00002 /* 
00003  * Squad.h
00004  */
00005 #include "Agent.h"
00006 #include "Common.h"
00007 
00008 
00009 class Squad
00010 {
00011 private:
00012     AgentSet agents;
00013     Agent* leader;
00014 
00015 public:
00016     Squad();
00017     Squad(const Squad& other);
00018     ~Squad();
00019 
00020     Squad& operator=(const Squad& rhs);
00021 
00022     void update();
00023         void draw();
00024 
00025     inline void addAgent(Agent* agent)    { agents.insert(agent); }
00026     inline void removeAgent(Agent* agent) { agents.erase(agent); }
00027 
00028     inline bool isAssigned(Agent* agent)  
00029     { 
00030         if( agents.find(agent) != agents.end() )
00031             return true;
00032         else 
00033             return false;
00034     }
00035 
00036     inline AgentSet& getAgents() { return agents; }
00037     inline Agent* getLeader()    { return leader; }
00038 
00039     inline void setLeader(Agent* agent)
00040     {
00041         if( leader == agent ) 
00042             return;
00043         if( !isAssigned(agent) )
00044             addAgent(agent);
00045         leader = agent;
00046     }
00047 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines