BWAPI
Public Member Functions | Static Public Member Functions
AgentManager Class Reference

#include <AgentManager.h>

List of all members.

Public Member Functions

 ~AgentManager ()
void addAgent (Unit *unit)
void removeAgent (Unit *unit)
void morphDrone (Unit *unit)
void computeActions ()
int getNoWorkers ()
int noMiningWorkers ()
BaseAgentfindClosestFreeWorker (TilePosition pos)
bool isAnyAgentRepairingThisAgent (BaseAgent *repairedAgent)
int countNoUnits (UnitType type)
int countNoBases ()
vector< BaseAgent * > getAgents ()
int size ()
BaseAgentgetAgent (int unitID)
BaseAgentgetAgent (UnitType type)
void requestOverlord (TilePosition pos)
BaseAgentgetClosestAgent (TilePosition pos, UnitType type)
BaseAgentgetClosestBase (TilePosition pos)
TilePosition getClosestDetector (TilePosition startPos)
bool unitsInArea (TilePosition pos, int tileWidth, int tileHeight, int unitID)
void cleanup ()

Static Public Member Functions

static AgentManagergetInstance ()

Detailed Description

The AgentManager class is a container that holds a list of all active agents in the game. Each unit, worker, building or or addon is assigned to an agent. See the MainAgents, StructureAgents and UnitAgents folders for detailed information about each specific type of agent.

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

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


Constructor & Destructor Documentation


Member Function Documentation

void AgentManager::addAgent ( Unit unit)

Adds an agent to the container. Is called each time a new unit is built.

Here is the call graph for this function:

Here is the caller graph for this function:

Removes inactive agents from the container. Shouldn't be called too often.

Here is the caller graph for this function:

Called each update to issue commands from all active agents.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the number of bases the player has.

Here is the caller graph for this function:

Returns the number of own units of a specific type.

Returns the closest free worker from the specified position, or NULL if not found.

Here is the call graph for this function:

Here is the caller graph for this function:

BaseAgent * AgentManager::getAgent ( int  unitID)

Returns a reference to the agent associated with a specific unit, or NULL if the unit doesn't exist.

Here is the caller graph for this function:

Returns the first agent in the list of the specified type, or NULL if not found.

Returns a list of all agents in the container.

Here is the caller graph for this function:

Returns the closest agent in the list of the specified type, or NULL if not found.

Here is the caller graph for this function:

Returns the closest base agent (Terran Command Center, Protoss Nexus), in the list, or NULL if not found.

Here is the caller graph for this function:

Returns the position of the closest detector unit relative to startPos. Returns TilePosition(-1, -1) if none was found.

Here is the call graph for this function:

Returns the instance to the AgentManager.

Here is the caller graph for this function:

Returns the current number of active worker units.

Here is the call graph for this function:

Here is the caller graph for this function:

Checks if any agent has the task to repair this specified agent.

Here is the call graph for this function:

void AgentManager::morphDrone ( Unit unit)

Called when a Zerg Drone is morphed into another unit.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the current number of active workers gathering minerals.

Here is the call graph for this function:

void AgentManager::removeAgent ( Unit unit)

Removes an agent from the container. Is called each time a unit is destroyed. The agents are not directly removed, but set to inactive and are removed during the cleanup.

Here is the call graph for this function:

Here is the caller graph for this function:

Requests a free Zerg Overlord to move to the specified position.

Returns the number of agents the exists in the vector.

bool AgentManager::unitsInArea ( TilePosition  pos,
int  tileWidth,
int  tileHeight,
int  unitID 
)

Checks if there are any units in an area. The unit with id unitID is allowed.

Here is the call graph for this function:


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