BWAPI
Public Member Functions | Private Attributes
SupplyManagerClass Class Reference

#include <SupplyManager.h>

List of all members.

Public Member Functions

 SupplyManagerClass ()
void update ()

Private Attributes

TaskPointer mLastItem

Detailed Description

Definition at line 8 of file SupplyManager.h.


Constructor & Destructor Documentation

Definition at line 11 of file SupplyManager.h.

{}

Member Function Documentation

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);
                }
        }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 16 of file SupplyManager.h.

Referenced by update().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines