BWAPI
SnippyHolloW-BroodwarBotQ-f01ab56/src/Macro/MorphManager.h
Go to the documentation of this file.
00001 #pragma once
00002 #include "Macro/Arbitrator.h"
00003 #include <BWAPI.h>
00004 class MorphManager : public Arbitrator::Controller<BWAPI::Unit*,double>
00005 {
00006   public:
00007     class Unit
00008     {
00009       public:
00010         BWAPI::UnitType type;
00011         bool started;
00012     };
00013     MorphManager(Arbitrator::Arbitrator<BWAPI::Unit*,double>* arbitrator);
00014     virtual void onOffer(std::set<BWAPI::Unit*> units);
00015     virtual void onRevoke(BWAPI::Unit* unit, double bid);
00016     virtual void update();
00017     virtual std::string getName() const;
00018     virtual std::string getShortName() const;
00019 
00020     void onRemoveUnit(BWAPI::Unit* unit);
00021     bool morph(BWAPI::UnitType type);
00022     int getPlannedCount(BWAPI::UnitType type) const;
00023     int getStartedCount(BWAPI::UnitType type) const;
00024     BWAPI::UnitType getBuildType(BWAPI::Unit* unit) const;
00025 
00026   private:
00027     bool canMake(BWAPI::Unit* builder, BWAPI::UnitType type);
00028     Arbitrator::Arbitrator<BWAPI::Unit*,double>* arbitrator;
00029     std::map<BWAPI::UnitType,std::list<BWAPI::UnitType> > morphQueues;
00030     std::map<BWAPI::Unit*,Unit> morphingUnits;
00031     std::map<BWAPI::UnitType, int> plannedCount;
00032     std::map<BWAPI::UnitType, int> startedCount;
00033 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines