BWAPI
Public Member Functions
StructureAgent Class Reference

#include <StructureAgent.h>

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

List of all members.

Public Member Functions

virtual void update ()
 StructureAgent (BWAPI::Unit &u)

Detailed Description

Definition at line 7 of file StructureAgent.h.


Constructor & Destructor Documentation

StructureAgent::StructureAgent ( BWAPI::Unit &  u) [inline]

Definition at line 11 of file StructureAgent.h.

: Agent(u) {}

Member Function Documentation

void StructureAgent::update ( ) [virtual]

Reimplemented from Agent.

Reimplemented in BarracksAgent, CommandCenterAgent, and RefineryAgent.

Definition at line 4 of file StructureAgent.cpp.

References BuildState, IdleState, Agent::state, TrainState, Agent::unit, and Agent::unitTypeTarget.

{
        // Send Units to nearest chokepoint
    BWTA::Chokepoint* chokepoint = BWTA::getNearestChokepoint(unit.getPosition());
    if( chokepoint != NULL )
        unit.setRallyPoint(chokepoint->getCenter());

        switch (state)
        {
        case IdleState:
                // fall through

        case TrainState:
                if (!unit.isTraining() && !unit.isBeingConstructed()) 
                {
                        unit.train(unitTypeTarget);
                }
                else
                {
                        //state = IdleState;
                }
                break;

                case BuildState:
                if (unitTypeTarget.isAddon())
                {
                        if (unit.getAddon()->getType().getID() != unitTypeTarget.getID())
                                unit.buildAddon(unitTypeTarget);
                        else
                                state = IdleState;
                }
        }
}

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