BWAPI
BasicAIModule/include/Managers/BuildManager.h
Go to the documentation of this file.
00001 #pragma once
00002 /*
00003  *  BuildManager.h
00004  *  
00005  *  Used to produce new units, buildings and add-ons
00006  *  Passes tasks down to the Construction or Production Managers
00007  */
00008 #include "Manager.h"
00009 
00010 // States a req can be in
00011 enum BuildReqState {
00012         NEW,
00013         ISSUED,
00014         STARTED,
00015         COMPLETE
00016 };
00017 
00018 // Information needed to complete a build request
00019 typedef struct BuildReq {
00020         // External
00021         BWAPI::UnitType type;
00022         BWAPI::TilePosition goalPosition;
00023         int count;
00024 
00025         // Internal
00026         BuildReqState state;
00027         BWAPI::Unit *builder; // SCV or Structure
00028 } BuildReq;
00029 
00030 
00031 class BuildManager : public Manager
00032 {
00033 private:
00034     queue<BuildReq> buildQueue;
00035     stack<BuildReq> buildStack;  // Active requests can be recursive (dependencies)
00036 
00037     void drawDebugText();
00038 
00039 public: 
00040         void update();
00041         void draw();
00042 
00043         void build(BWAPI::UnitType type, bool immediate=false);
00044         void build(BWAPI::UnitType type, BWAPI::TilePosition goalPosition, bool immediate=false);
00045 
00046     virtual const std::string& getName() const 
00047     {
00048         static const std::string name("BuildMgr");
00049         return name; 
00050     }
00051 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines