BTHAI 2.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
BuildPlanner Class Reference

#include <BuildPlanner.h>

List of all members.

Public Member Functions

 ~BuildPlanner ()
int noInProduction (UnitType type)
void computeActions ()
void buildingDestroyed (Unit *building)
void unlock (UnitType type)
void remove (UnitType type)
void handleWorkerDestroyed (UnitType type, int workerID)
void commandCenterBuilt ()
void printInfo ()
void handleNoBuildspotFound (UnitType toBuild)
bool shallBuildSupply ()
bool supplyBeingBuilt ()
bool nextIsOfType (UnitType type)
bool containsType (UnitType type)
void addBuilding (UnitType type)
void addBuildingFirst (UnitType type)
void expand (UnitType commandCenterUnit)
void addRefinery ()
bool executeMorph (UnitType target, UnitType evolved)

Static Public Member Functions

static BuildPlannergetInstance ()
static bool coveredByDetector (TilePosition pos)
static bool isTerran ()
static bool isProtoss ()
static bool isZerg ()

Protected Member Functions

void lock (int buildOrderIndex, int unitId)
bool executeOrder (UnitType type)
bool shallBuildSupplyDepot ()
string format (UnitType type)
bool hasResourcesLeft ()
int mineralsNearby (TilePosition center)

Protected Attributes

vector< UnitType > buildOrder
vector< BuildQueueItembuildQueue
int lastCommandCenter
int lastCallFrame

Detailed Description

The BuildPlanner class contains the build order for all buildings and addons that will be constructed during the course of a game. This class is not directly used, instead each race (Terran, Protoss, Zerg) has their own build order class that extends BuildPlanner.

The BuildPlanner is implemented as a singleton class. Each class that needs to access BuildPlanner can request an instance, and all classes shares the same BuildPlanner instance.

Author: Johan Hagelback (johan.hagelback@gmail.com)


Constructor & Destructor Documentation

BuildPlanner::~BuildPlanner ( )

Destructor.


Member Function Documentation

void BuildPlanner::addBuilding ( UnitType  type)

Adds a building to the buildorder queue.

void BuildPlanner::addBuildingFirst ( UnitType  type)

Adds a building first in the buildorder queue.

void BuildPlanner::addRefinery ( )

Adds a refinery to the buildorder list.

void BuildPlanner::buildingDestroyed ( Unit *  building)

Notifies that an own unit has been destroyed.

void BuildPlanner::commandCenterBuilt ( )

Sets that a new command center has been built.

void BuildPlanner::computeActions ( )

Called each update to issue orders.

bool BuildPlanner::containsType ( UnitType  type)

Returns true if buildorder contains a unit of the specified type.

bool BuildPlanner::coveredByDetector ( TilePosition  pos) [static]

Checks if the specified TilePosition is covered by a detector buildings sight radius.

bool BuildPlanner::executeMorph ( UnitType  target,
UnitType  evolved 
)

Morphs a Zerg drone to a building.

void BuildPlanner::expand ( UnitType  commandCenterUnit)

Requests to expand the base.

BuildPlanner * BuildPlanner::getInstance ( ) [static]

Returns the instance to the BuildPlanner that is currently used.

void BuildPlanner::handleNoBuildspotFound ( UnitType  toBuild)

Is called when no buildspot has been found for the specified type. Gives each buildplanner an opportunity to handle it.

void BuildPlanner::handleWorkerDestroyed ( UnitType  type,
int  workerID 
)

Called when a worker that is constructing a building is destroyed.

bool BuildPlanner::isProtoss ( ) [static]

Returns true if the player is Protoss.

bool BuildPlanner::isTerran ( ) [static]

Returns true if the player is Terran.

bool BuildPlanner::isZerg ( ) [static]

Returns true if the player is Zerg.

bool BuildPlanner::nextIsOfType ( UnitType  type)

Returns true if next in buildorder is of the specified type. Returns false if buildorder is empty.

int BuildPlanner::noInProduction ( UnitType  type)

Returns the number of units of the specified type currently being produced.

void BuildPlanner::printInfo ( )

Shows some debug info on screen.

void BuildPlanner::remove ( UnitType  type)

Removes a building from the buildorder.

bool BuildPlanner::shallBuildSupply ( )

Checks if more supply buildings are needed.

bool BuildPlanner::supplyBeingBuilt ( )

Checks if a supply is under construction.

void BuildPlanner::unlock ( UnitType  type)

When a request to construct a new building is issued, no construction are allowed until the worker has moved to the buildspot and started constructing the building. This is to avoid that the needed resources are not used up by other build orders. During this time the BuildPlanner is locked, and new construction can only be done when unlock has been called.


The documentation for this class was generated from the following files:
 All Classes Functions Variables