|
BWAPI
|
#include <SupplyManager.h>
Public Member Functions | |
| SupplyManagerClass () | |
| void | update () |
Private Attributes | |
| TaskPointer | mLastItem |
Definition at line 8 of file SupplyManager.h.
| SupplyManagerClass::SupplyManagerClass | ( | ) | [inline] |
Definition at line 11 of file SupplyManager.h.
{}
| void SupplyManagerClass::update | ( | ) |
Definition at line 7 of file SupplyManager.cpp.
References BWAPI::Broodwar, BWAPI::UnitType::buildTime(), BWAPI::Game::getFrameCount(), BWAPI::Orders::getOrder(), BWAPI::Player::getRace(), BWAPI::Races::getRace(), BWAPI::Race::getSupplyProvider(), Singleton< T >::Instance(), mLastItem, BWAPI::Game::self(), TaskTypeDef::Supply, OrderDef::SupplyManager, and BWAPI::Player::supplyUsed().
{
if(!BuildOrderManager::Instance().getOrder(Order::SupplyManager))
return;
const int &supplyTime = BWAPI::Broodwar->getFrameCount() + BWAPI::Broodwar->self()->getRace().getSupplyProvider().buildTime() + 150;
if(ResourceTracker::Instance().totalSupplyAtTime(supplyTime) < 400)
{
const int currentSupply = BWAPI::Broodwar->self()->supplyUsed();
const int &freeSupply = ResourceTracker::Instance().availableSupplyAtTime(supplyTime);
if(freeSupply <= (currentSupply > 120 ? 16 : currentSupply > 60 ? 8 : 0))
{
if(!mLastItem || mLastItem->hasDispatched() || mLastItem->hasEnded())
mLastItem = TaskManager::Instance().build(BWAPI::Broodwar->self()->getRace().getSupplyProvider(), TaskType::Supply);
}
}
}

TaskPointer SupplyManagerClass::mLastItem [private] |
Definition at line 16 of file SupplyManager.h.
Referenced by update().
1.7.6.1