BWAPI
|
#include <BuildPlanner.h>
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)
BuildPlanner::BuildPlanner | ( | ) | [protected] |
Destructor.
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.
bool BuildPlanner::executeOrder | ( | UnitType | type | ) | [protected] |
void BuildPlanner::expand | ( | UnitType | commandCenterUnit | ) |
Requests to expand the base.
string BuildPlanner::format | ( | UnitType | type | ) | [protected] |
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::hasResourcesLeft | ( | ) | [protected] |
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.
void BuildPlanner::lock | ( | int | buildOrderIndex, |
int | unitId | ||
) | [protected] |
int BuildPlanner::mineralsNearby | ( | TilePosition | center | ) | [protected] |
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::shallBuildSupplyDepot | ( | ) | [protected] |
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.
vector<UnitType> BuildPlanner::buildOrder [protected] |
vector<BuildQueueItem> BuildPlanner::buildQueue [protected] |
int BuildPlanner::lastCallFrame [protected] |
int BuildPlanner::lastCommandCenter [protected] |