BWAPI
Public Member Functions | Static Public Member Functions | Protected Attributes
BaseAgent Class Reference

#include <BaseAgent.h>

Inheritance diagram for BaseAgent:
Inheritance graph
[legend]
Collaboration diagram for BaseAgent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BaseAgent ()
 BaseAgent (Unit *mUnit)
 ~BaseAgent ()
virtual void computeActions ()
int noUnitsInWeaponRange ()
bool canAttack (Unit *target)
bool canAttack (UnitType type)
virtual void setGoal (TilePosition goal)
virtual void clearGoal ()
TilePosition getGoal ()
void setActionFrame ()
int getLastActionFrame ()
virtual string getTypeName ()
virtual bool assignToBuild (UnitType type)
virtual bool assignToRepair (Unit *building)
virtual bool assignToFinishBuild (Unit *building)
virtual void assignToExplore ()
virtual void assignToAttack ()
virtual void assignToDefend ()
virtual bool isExploring ()
virtual bool isAttacking ()
virtual bool isDefending ()
virtual void printInfo ()
void setInfo (string mInfo)
virtual bool canBuild (UnitType type)
int getUnitID ()
UnitType getUnitType ()
UnitgetUnit ()
virtual void destroyed ()
bool isAlive ()
bool matches (Unit *mUnit)
bool isOfType (UnitType type)
bool isDetectorWithinRange (TilePosition pos, int range)
bool isBuilding ()
bool isWorker ()
bool isFreeWorker ()
bool isUnit ()
bool isUnderAttack ()
bool isDamaged ()
void setSquadID (int id)
int getSquadID ()

Static Public Member Functions

static bool isOfType (Unit *mUnit, UnitType type)
static bool isOfType (UnitType mType, UnitType toCheckType)
static bool doScannerSweep (TilePosition pos)
static bool doEnsnare (TilePosition pos)

Protected Attributes

Unitunit
TilePosition goal
int unitID
int squadID
bool alive
int lastActionFrame
string info
bool bBlock

Detailed Description

The BaseAgent is the base agent class all agent classes directly or indirectly must extend. It contains some common logic that is needed for several other agent implementations.

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


Constructor & Destructor Documentation

Default constructor. Not used.

Here is the caller graph for this function:

BaseAgent::BaseAgent ( Unit mUnit)

Constructor.

Here is the call graph for this function:

Destructor.


Member Function Documentation

virtual void BaseAgent::assignToAttack ( ) [inline, virtual]

Assigns this agent to be in the attack force.

Reimplemented in UnitAgent.

virtual bool BaseAgent::assignToBuild ( UnitType  type) [inline, virtual]

Assigns the agent to build the specified type of unit.

Reimplemented in WorkerAgent.

Here is the caller graph for this function:

virtual void BaseAgent::assignToDefend ( ) [inline, virtual]

Assigns this agent to defend the base.

Reimplemented in UnitAgent.

virtual void BaseAgent::assignToExplore ( ) [inline, virtual]

Assigns this agent to explore the game world.

Reimplemented in UnitAgent.

virtual bool BaseAgent::assignToFinishBuild ( Unit building) [inline, virtual]

Assigns the agent to continue building a non-finished building.

Reimplemented in WorkerAgent.

Here is the caller graph for this function:

virtual bool BaseAgent::assignToRepair ( Unit building) [inline, virtual]

Assigns the agent to repair a unit.

Reimplemented in WorkerAgent.

Here is the caller graph for this function:

bool BaseAgent::canAttack ( Unit target)

Checks if this unit can attack the specified target unit.

Here is the call graph for this function:

Here is the caller graph for this function:

Checks if this unit can attack the specified unit type.

Here is the call graph for this function:

bool BaseAgent::canBuild ( UnitType  type) [virtual]

Returns true if this agent can build units of the specified type.

Reimplemented in WorkerAgent.

Here is the call graph for this function:

Here is the caller graph for this function:

void BaseAgent::clearGoal ( ) [virtual]

Clears the goal for this unit.

Reimplemented in UnitAgent, and ReaverAgent.

virtual void BaseAgent::computeActions ( ) [inline, virtual]
void BaseAgent::destroyed ( ) [virtual]

Called when the unit assigned to this agent is destroyed.

Reimplemented in WorkerAgent.

bool BaseAgent::doEnsnare ( TilePosition  pos) [static]

Orders the Zerg Queen to do an Ensnare at the specified area.

Here is the call graph for this function:

bool BaseAgent::doScannerSweep ( TilePosition  pos) [static]

Orders the Terran Comsat Station to do a Scanner Sweep at the specified area.

Here is the call graph for this function:

Returns the current goal for this unit.

Here is the caller graph for this function:

Returns the last frame this agent was issued an order.

Returns the squad this agent belongs to, or -1 if it doesnt belong to any squad.

Here is the caller graph for this function:

virtual string BaseAgent::getTypeName ( ) [inline, virtual]

Returns a reference to the unit assigned to this agent.

Returns the unique id for this agent. Agent id is the same as the id of the unit assigned to the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the type for the unit handled by this agent.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if this agent is active, i.e. the unit is not destroyed.

Here is the caller graph for this function:

virtual bool BaseAgent::isAttacking ( ) [inline, virtual]

Returns true if this agent is used to attack the enemy.

Reimplemented in UnitAgent.

Returns true if this agent is a building.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if this agent is damaged.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool BaseAgent::isDefending ( ) [inline, virtual]

Returns true if this agent is defending the own base.

Reimplemented in UnitAgent.

bool BaseAgent::isDetectorWithinRange ( TilePosition  pos,
int  range 
)

Checks if there are any enemy detector units withing range of the specified position. True if there is, false if not.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool BaseAgent::isExploring ( ) [inline, virtual]

Returns true if this agent is used to explore the game world.

Reimplemented in UnitAgent.

Here is the caller graph for this function:

Returns true if this agent is a free worker, i.e. is idle or is gathering minerals.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BaseAgent::isOfType ( UnitType  type)

Returns true if the agent is of the specified type.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BaseAgent::isOfType ( Unit mUnit,
UnitType  type 
) [static]

Returns true if the unit is of the specified type.

Here is the call graph for this function:

bool BaseAgent::isOfType ( UnitType  mType,
UnitType  toCheckType 
) [static]

Returns true if mType is the same UnitType as toCheckType.

Here is the call graph for this function:

Returns true if this agent is under attack, i.e. lost hitpoints since last check.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if this agent is a combat unit.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if this agent is a worker.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BaseAgent::matches ( Unit mUnit)

Returns true if the specified unit is the same unit assigned to this agent.

Here is the call graph for this function:

Returns the number of enemy units within weapon range of the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

void BaseAgent::printInfo ( ) [virtual]

Used to print info about this agent to the screen.

Reimplemented in UnitAgent, StructureAgent, and BunkerAgent.

Here is the call graph for this function:

Here is the caller graph for this function:

Sets the current frame when this agent is issued an order.

Here is the call graph for this function:

void BaseAgent::setGoal ( TilePosition  goal) [virtual]

Sets the goal for this unit. Goals are set from either the SquadCommander for attacking or defending units, or from ExplorationManager for explore units.

Reimplemented in UnitAgent, and ReaverAgent.

Here is the call graph for this function:

Here is the caller graph for this function:

void BaseAgent::setInfo ( string  mInfo)

Sets additional information about this agent to be shown when using printInfo().

Here is the caller graph for this function:

void BaseAgent::setSquadID ( int  id)

Assigns this agent to the squad with the specified id.

Here is the caller graph for this function:


Member Data Documentation

bool BaseAgent::alive [protected]
bool BaseAgent::bBlock [protected]
string BaseAgent::info [protected]
int BaseAgent::lastActionFrame [protected]
int BaseAgent::squadID [protected]
Unit* BaseAgent::unit [protected]
int BaseAgent::unitID [protected]

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