BWAPI
BTHAI/SCProjects/BTHAIModule/Source/ResourceManager.h
Go to the documentation of this file.
00001 #ifndef __RESOURCEMANAGER_H__
00002 #define __RESOURCEMANAGER_H__
00003 
00004 #include <BWAPI.h>
00005 
00006 using namespace BWAPI;
00007 using namespace std;
00008 
00009 struct ResourceLock {
00010         UnitType unit;
00011         int mineralCost;
00012         int gasCost;
00013 
00014         ResourceLock(UnitType mUnit) {
00015                 unit = mUnit;
00016                 mineralCost = mUnit.mineralPrice();
00017                 gasCost = mUnit.gasPrice();
00018         }
00019 };
00020 
00029 class ResourceManager {
00030 
00031 private:
00032         static ResourceManager* instance;
00033 
00034         ResourceManager();
00035 
00036         bool hasProductionBuilding();
00037         
00038         vector<ResourceLock> locks;
00039 
00040         int calcLockedMinerals();
00041         int calcLockedGas();
00042 
00043 public:
00045         ~ResourceManager();
00046 
00048         static ResourceManager* getInstance();
00049 
00051         bool needWorker();
00052 
00054         bool hasResources(UnitType type);
00055 
00057         bool hasResources(UpgradeType type);
00058 
00060         bool hasResources(TechType type);
00061 
00063         bool hasResources(int neededMinerals, int neededGas);
00064 
00066         void lockResources(UnitType type);
00067 
00069         void unlockResources(UnitType type);
00070 
00072         void printInfo();
00073 };
00074 
00075 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines