BWAPI
SnippyHolloW-BroodwarBotQ-f01ab56/src/Micro/UnitManager/UnitSet.h
Go to the documentation of this file.
00001 #pragma once
00002 #include <BWAPI.h>
00003 #include <list>
00004 
00005 #include "Objective.h"
00006 class Objective;
00007 
00008 typedef enum
00009 {
00010         DEFEND_BASE_GO = 0,
00011         ATTACK_BASE_GO = 1,
00012         EXPLORE_GO     = 2,
00013         DROP_GO        = 3,
00014         PATROL_GO      = 4,
00015         BLOCK_SLOPE_GO = 5,
00016         ND_GO          = 0
00017 } groupObjective_t;
00018 
00019 typedef enum
00020 {
00021         OBJ_IN_PROGRESS_GS = 1,
00022         MOVE_TO_OBJ_GS     = 2,
00023         WAIT_4_UNITS_GS    = 3,
00024         FLEE_OBJ_GS        = 4,
00025         ND_GS              = 0
00026 } groupStatus_t;
00027 
00028 class UnitSet
00029 {
00030 protected : 
00031         std::list<BWAPI::Unit*> lUnits_;          
00032         groupObjective_t objective_;              
00033         groupStatus_t status_;                    
00034         BWAPI::Position curPos_;                  
00035         BWAPI::Position objPos_;                  
00037         /*************** Constructors and destructors ***************/
00038 public : 
00042         UnitSet();
00043 
00049         UnitSet(groupObjective_t obj,BWAPI::Position pos);
00050 
00055         UnitSet(BWAPI::Position regroupPos);
00056 
00060         ~UnitSet();
00061 
00062         /************************* Accessors ************************/
00063 
00064 protected : 
00068         void updateAvgPos();
00069 
00070 public : 
00074         inline BWAPI::Position curPos() const { return this->curPos_; }
00075 
00080         BWAPI::Position pos() const;
00081 
00086         BWAPI::Position objPos() const;
00087 
00092         inline bool empty() const { return lUnits_.empty(); }
00093 
00098         inline int nbUnits() const { return lUnits_.size(); }
00099 
00100         /************************** Actions *************************/
00101 
00102 public : 
00107         void moveTo(BWAPI::Position pos);
00108 
00113         void attackTo(const BWAPI::Position pos);
00114 
00119         void patrolTo(BWAPI::Position pos);
00120 
00124         void stop();
00125 
00126         /******************** Objective evaluation ******************/
00127 
00133         bool canFulFillObj(Objective* obj) const;
00134 
00135         /********************** Units management ********************/
00136 
00142         bool requires(BWAPI::Unit* unit) const;
00143 
00148         void addUnit(BWAPI::Unit* unit);
00149 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines