TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cherrypi::AttackTracker Class Reference

Tracks a set of units attacking enemy units. More...

#include <commandtrackers.h>

Inherits cherrypi::Tracker.

Public Member Functions

 AttackTracker (std::unordered_set< Unit * > units, std::unordered_set< Unit * > enemies, int timeout=30)
 
virtual ~AttackTracker ()
 
void setUnits (std::unordered_set< Unit * > units)
 
- Public Member Functions inherited from cherrypi::Tracker
 Tracker (int timeout)
 
virtual ~Tracker ()
 
TrackerStatus status () const
 
void cancel ()
 
bool failed () const
 
bool succeeded () const
 
virtual bool update (State *s)
 Updates the tracker. More...
 

Protected Member Functions

virtual bool updateNotTracking (State *s)
 Updates the tracker if its status is NotTracking. More...
 
virtual bool updatePending (State *s)
 Updates the tracker if its status is Pending. More...
 
virtual bool updateOngoing (State *s)
 Updates the tracker if its status is Ongoing. More...
 
void updateEnemies ()
 

Protected Attributes

std::unordered_set< Unit * > units_
 
std::unordered_set< Unit * > enemies_
 
- Protected Attributes inherited from cherrypi::Tracker
TrackerStatus status_ = TrackerStatus::NotTracking
 
int time_ = 0
 
int timeout_
 

Detailed Description

Tracks a set of units attacking enemy units.

Ongoing is defined as at least one unit firing bullets. The tracker might switch back to Pending if no unit is firing. Success is defined in terms of all enemy units being dead.

Constructor & Destructor Documentation

cherrypi::AttackTracker::AttackTracker ( std::unordered_set< Unit * >  units,
std::unordered_set< Unit * >  enemies,
int  timeout = 30 
)
virtual cherrypi::AttackTracker::~AttackTracker ( )
inlinevirtual

Member Function Documentation

void cherrypi::AttackTracker::setUnits ( std::unordered_set< Unit * >  units)
inline
void cherrypi::AttackTracker::updateEnemies ( )
protected
bool cherrypi::AttackTracker::updateNotTracking ( State s)
protectedvirtual

Updates the tracker if its status is NotTracking.

Returns true if status has changed

Implements cherrypi::Tracker.

bool cherrypi::AttackTracker::updateOngoing ( State s)
protectedvirtual

Updates the tracker if its status is Ongoing.

Returns true if status has changed

Implements cherrypi::Tracker.

bool cherrypi::AttackTracker::updatePending ( State s)
protectedvirtual

Updates the tracker if its status is Pending.

Returns true if status has changed

Implements cherrypi::Tracker.

Member Data Documentation

std::unordered_set<Unit*> cherrypi::AttackTracker::enemies_
protected
std::unordered_set<Unit*> cherrypi::AttackTracker::units_
protected

The documentation for this class was generated from the following files: