BWAPI
UAlbertaBot_src/Projects/UAlbertaBot/Source/micromanagement/MicroManager.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "Common.h"
00004 #include "../MapGrid.h"
00005 #include "../SquadOrder.h"
00006 #include "../MapTools.h"
00007 
00008 struct AirThreat
00009 {
00010         BWAPI::Unit *   unit;
00011         double                  weight;
00012 };
00013 
00014 struct GroundThreat
00015 {
00016         BWAPI::Unit *   unit;
00017         double                  weight;
00018 };
00019 
00020 class MicroManager
00021 {
00022         UnitVector                      units;
00023         int                                     lastRegroupPerformed;
00024 
00025 protected:
00026 
00027         virtual void            executeMicro(const UnitVector & targets, BWAPI::Position regroup = BWAPI::Position(0,0)) {}
00028         virtual void            harassMove(BWAPI::Unit * muta, BWAPI::Position location) {}
00029         bool                            checkPositionWalkable(BWAPI::Position pos);
00030         bool                            drawDebugVectors;
00031         void                            drawOrderText();
00032         void                            smartAttackUnit(BWAPI::Unit * attacker, BWAPI::Unit * target);
00033         void                            smartAttackMove(BWAPI::Unit * attacker, BWAPI::Position targetPosition);
00034         void                            smartMove(BWAPI::Unit * attacker, BWAPI::Position targetPosition);
00035         bool                            unitNearEnemy(BWAPI::Unit * unit);
00036         bool                            unitNearChokepoint(BWAPI::Unit * unit) const;
00037 
00038         SquadOrder                      order;
00039 
00040 public:
00041                                                 MicroManager() : drawDebugVectors(true), lastRegroupPerformed(0) {}
00042     virtual                             ~MicroManager(){}
00043 
00044         const UnitVector &      getUnits() const { return units; }
00045         BWAPI::Position     calcCenter() const;
00046 
00047         void                            setUnits(const UnitVector & units) { this->units = units; }
00048         void                            execute(const SquadOrder & order, BWAPI::Position regroup);
00049 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines