BWAPI
|
00001 #pragma once 00002 /* 00003 * Manager.h - Managers control Agents. 00004 */ 00005 #include "Common.h" 00006 00007 #include <BWAPI.h> 00008 00009 #include <string> 00010 00011 class Strategizer; 00012 00013 00014 class Manager 00015 { 00016 protected: 00017 AgentSet agents; 00018 TaskQueue tasks; 00019 00020 /* getAgentsOfType - Gets an AgentSet containing all owned Agents of the specified type, from this Manager's AgentSet */ 00021 AgentSet getAgentsOfType(BWAPI::UnitType type); 00022 /* getAgentsOfType - Gets an AgentSet containing all owned Agents of the specified type, from the specified AgentSet */ 00023 AgentSet getAgentsOfType(BWAPI::UnitType type, AgentSet& agentSet); 00024 00025 public: 00026 friend class Strategizer; // Either this or declare public const versions of getAgentsOfType() 00027 00028 /* onMatchStart - Called when a new match begins */ 00029 virtual void onMatchStart() { } 00030 00031 /* update - Called on each frame */ 00032 virtual void update(); 00033 /* draw - draw debug info */ 00034 virtual void draw(); 00035 00036 /* addAgent - Add an Agent to the Managers Agent set */ 00037 virtual void addAgent(Agent &t); 00038 /* removeAgent - Remove an Agent of @ut from the Managers Agent set */ 00039 virtual Agent* removeAgent(BWAPI::UnitType ut); 00040 /* removeAllAgents - Remove all agents */ 00041 void removeAllAgents(); 00042 00043 /* addTask - Add this task to the task queue */ 00044 virtual void addTask(Task &t); 00045 /* doTask - Do this task without entering the queue */ 00046 virtual void doTask(Task &t); 00047 00048 /* mwtpNext - Value currently placed on accepting one more of this unit type */ 00049 virtual int mwtpNext(BWAPI::UnitType &ut); 00050 /* mwtpLast - Value currently placed on the last of this unit type */ 00051 virtual int mwtpLast(BWAPI::UnitType &ut); 00052 /* estimateCost - best estimate at the cost of completing this task */ 00053 virtual int estimateCost(Task &t); 00054 00055 /* numAgents - Find out how many Agents of any unit type this Manager owns */ 00056 int Manager::numAgents() const; 00057 /* numAgents - Find out how many Agents of @type this Manager owns */ 00058 int numAgents(BWAPI::UnitType type); 00059 00060 /* getName - Returns an stl string representation of this Manager's name */ 00061 virtual const std::string& getName() const 00062 { 00063 static const std::string name("INVALID"); 00064 return name; 00065 } 00066 }; 00067 00068 00069