SC2API
An API for AI for StarCraft II
Classes | Enumerations | Functions
sc2_client.h File Reference

The base class for Agent and ReplayObserver. More...

#include <string>
#include <vector>
#include <cassert>
#include "sc2api/sc2_typeenums.h"

Go to the source code of this file.

Classes

class  sc2::ClientEvents
 A set of common events a user can override in their derived bot or replay observer class. More...
 
class  sc2::Client
 The base class for Agent and ReplayObserver. More...
 
struct  sc2::IsVisible
 

Enumerations

enum  sc2::ClientError {
  ErrorSC2, InvalidAbilityRemap, sc2::ClientError::InvalidResponse, sc2::ClientError::NoAbilitiesForTag,
  sc2::ClientError::ResponseNotConsumed, sc2::ClientError::ResponseMismatch, sc2::ClientError::ConnectionClosed, sc2::ClientError::SC2UnknownStatus,
  SC2AppFailure, sc2::ClientError::SC2ProtocolError, sc2::ClientError::SC2ProtocolTimeout, sc2::ClientError::WrongGameVersion
}
 

Functions

bool sc2::IsCarryingMinerals (const Unit &unit)
 
bool sc2::IsCarryingVespene (const Unit &unit)
 

Detailed Description

The base class for Agent and ReplayObserver.

The Client and ClientEvents provides most of the functionality a user would be interested in for examining game state and scripting bots. A user should prefer to inherit from either Agent or ReplayObserver, those classes both inherit from Client.

Enumeration Type Documentation

enum sc2::ClientError
strong

Errors that the api can encounter, if the OnError event in ClientEvents is overwritten it will contain a list of errors encountered.

Function Documentation

bool sc2::IsCarryingMinerals ( const Unit unit)

Helper function used to discover whether a unit is carrying minerals or not. You could use this function in GetUnits to get all units carrying minerals: Units units = GetUnits(Alliance::Self, IsCarryingMinerals);

Parameters
unitThe unit.
observationNot needed for this function, only exists for Filter parameters, leave nullptr (its default).
Returns
Returns true if the unit is carrying minerals, false otherwise.
bool sc2::IsCarryingVespene ( const Unit unit)

Helper function used to discover whether a unit is carrying vespene or not. You could use this function in GetUnits to get all units carrying vespene: Units units = GetUnits(Alliance::Self, IsCarryingVespene);

Parameters
unitThe unit.
observationNot needed for this function, only exists for Filter parameters, leave nullptr (its default).
Returns
Returns true if the unit is carrying vespene, false otherwise.