BWAPI
|
00001 #pragma once 00002 #include "Micro/Goals/Goal.h" 00003 #include "Utils/CSingleton.h" 00004 #include <stdlib.h> 00005 #include "Micro/UnitsGroup.h" 00006 #include <BWAPI.h> 00007 #include "Macro/Arbitrator.h" 00008 00009 /*** 00010 * A singleton which tracks count of created (in training / completed) 00011 * units + maintain a list of goals it dispatches update() to 00012 */ 00013 class GoalManager : public CSingleton<GoalManager> 00014 { 00015 friend class CSingleton<GoalManager>; 00016 private: 00017 bool _firstPoke; // hack, remove TODO 00018 std::list<pGoal> _goals; 00019 GoalManager(); 00020 ~GoalManager(); 00021 std::map<BWAPI::Unit*, pBayesianUnit> _completedUnits; 00022 std::list<BWAPI::Unit*> _inTrainingUnits; 00023 public: 00024 int attackGoals; 00025 void addGoal(pGoal g); 00026 void addGoals(const std::list<pGoal>& l); 00027 void onUnitCreate(BWAPI::Unit* u); 00028 void onUnitDestroy(BWAPI::Unit* u); 00029 void onUnitRenegade(BWAPI::Unit* u); 00030 const std::map<BWAPI::Unit*, pBayesianUnit>& getCompletedUnits() const; 00031 pBayesianUnit getCompletedUnit(BWAPI::Unit* u); 00032 00033 virtual void update(); 00034 };