BWAPI
|
00001 #pragma once 00002 00003 #include "Interface.h" 00004 00005 #include "Singleton.h" 00006 00007 class ResourceTrackerClass 00008 { 00009 public: 00010 ResourceTrackerClass(); 00011 00012 void reservePlannedMinerals(int time, int amount); 00013 void reservePlannedGas(int time, int amount); 00014 void reservePlannedSupply(int time, int amount); 00015 void reset(); 00016 00017 void reserveCurrentMinerals(int time, int amount); 00018 void reserveCurrentGas(int time, int amount); 00019 void reserveCurrentSupply(int time, int amount); 00020 00021 void releaseCurrentMinerals(int time, int amount); 00022 void releaseCurrentGas(int time, int amount); 00023 void releaseCurrentSupply(int time, int amount); 00024 00025 int earliestMineralAvailability(int amount); 00026 int earliestGasAvailability(int amount); 00027 int earliestSupplyAvailability(int amount); 00028 00029 int availableMineralAtTime(int time); 00030 int availableGasAtTime(int time); 00031 int availableSupplyAtTime(int time); 00032 00033 int totalMineralAtTime(int time); 00034 int totalGasAtTime(int time); 00035 int totalSupplyAtTime(int time); 00036 00037 double getMineralRate() { return mMineralRate; } 00038 double getGasRate() { return mGasRate; } 00039 void setMineralRate(double rate) { mMineralRate = rate; } 00040 void setGasRate(double rate) { mGasRate = rate; } 00041 00042 private: 00043 std::map<int, int> mSupplyTime; 00044 std::map<int, int> mFreeSupply; 00045 00046 // Time to Reserved resources, reset each frame 00047 std::map<int, int> mPlannedReservedMinerals; 00048 std::map<int, int> mPlannedReservedGas; 00049 std::map<int, int> mPlannedReservedSupply; 00050 00051 std::map<int, int> mCurrentReservedMinerals; 00052 std::map<int, int> mCurrentReservedGas; 00053 std::map<int, int> mCurrentReservedSupply; 00054 00055 double mMineralRate; 00056 double mGasRate; 00057 }; 00058 00059 typedef Singleton<ResourceTrackerClass> ResourceTracker;