#include <Game.h>
Public Member Functions | |
virtual std::set< Force * > & | getForces ()=0 |
virtual std::set< Player * > & | getPlayers ()=0 |
virtual std::set< Unit * > & | getAllUnits ()=0 |
virtual std::set< Unit * > & | getMinerals ()=0 |
virtual std::set< Unit * > & | getGeysers ()=0 |
virtual std::set< Unit * > & | getNeutralUnits ()=0 |
virtual std::set< Unit * > & | getStaticMinerals ()=0 |
virtual std::set< Unit * > & | getStaticGeysers ()=0 |
virtual std::set< Unit * > & | getStaticNeutralUnits ()=0 |
virtual std::set< Bullet * > & | getBullets ()=0 |
virtual std::set< Position > & | getNukeDots ()=0 |
virtual std::list< Event > & | getEvents ()=0 |
virtual Force * | getForce (int forceID)=0 |
virtual Player * | getPlayer (int playerID)=0 |
virtual Unit * | getUnit (int unitID)=0 |
virtual Unit * | indexToUnit (int unitIndex)=0 |
virtual GameType | getGameType ()=0 |
virtual int | getLatency ()=0 |
virtual int | getFrameCount ()=0 |
virtual int | getFPS ()=0 |
virtual double | getAverageFPS ()=0 |
virtual BWAPI::Position | getMousePosition ()=0 |
virtual bool | getMouseState (MouseButton button)=0 |
virtual bool | getMouseState (int button)=0 |
virtual bool | getKeyState (Key key)=0 |
virtual bool | getKeyState (int key)=0 |
virtual BWAPI::Position | getScreenPosition ()=0 |
virtual void | setScreenPosition (int x, int y)=0 |
virtual void | setScreenPosition (BWAPI::Position p)=0 |
virtual void | pingMinimap (int x, int y)=0 |
virtual void | pingMinimap (BWAPI::Position p)=0 |
virtual bool | isFlagEnabled (int flag)=0 |
virtual void | enableFlag (int flag)=0 |
virtual std::set< Unit * > & | getUnitsOnTile (int tileX, int tileY)=0 |
virtual std::set< Unit * > & | getUnitsInRectangle (int left, int top, int right, int bottom) const =0 |
virtual std::set< Unit * > & | getUnitsInRectangle (BWAPI::Position topLeft, BWAPI::Position bottomRight) const =0 |
virtual std::set< Unit * > & | getUnitsInRadius (BWAPI::Position center, int radius) const =0 |
virtual Error | getLastError () const =0 |
virtual bool | setLastError (BWAPI::Error e)=0 |
virtual int | mapWidth ()=0 |
virtual int | mapHeight ()=0 |
virtual std::string | mapFileName ()=0 |
virtual std::string | mapPathName ()=0 |
virtual std::string | mapName ()=0 |
virtual std::string | mapHash ()=0 |
virtual bool | isWalkable (int walkX, int walkY)=0 |
virtual int | getGroundHeight (int tileX, int tileY)=0 |
virtual int | getGroundHeight (TilePosition position)=0 |
virtual bool | isBuildable (int tileX, int tileY, bool includeBuildings=false)=0 |
virtual bool | isBuildable (TilePosition position, bool includeBuildings=false)=0 |
virtual bool | isVisible (int tileX, int tileY)=0 |
virtual bool | isVisible (TilePosition position)=0 |
virtual bool | isExplored (int tileX, int tileY)=0 |
virtual bool | isExplored (TilePosition position)=0 |
virtual bool | hasCreep (int tileX, int tileY)=0 |
virtual bool | hasCreep (TilePosition position)=0 |
virtual bool | hasPower (int tileX, int tileY, UnitType unitType=UnitTypes::None) const =0 |
virtual bool | hasPower (TilePosition position, UnitType unitType=UnitTypes::None) const =0 |
virtual bool | hasPower (int tileX, int tileY, int tileWidth, int tileHeight, UnitType unitType=UnitTypes::None) const =0 |
virtual bool | hasPower (TilePosition position, int tileWidth, int tileHeight, UnitType unitType=UnitTypes::None) const =0 |
virtual bool | hasPowerPrecise (int x, int y, UnitType unitType=UnitTypes::None) const =0 |
virtual bool | hasPowerPrecise (Position position, UnitType unitType=UnitTypes::None) const =0 |
virtual bool | canBuildHere (const Unit *builder, TilePosition position, UnitType type, bool checkExplored=false)=0 |
virtual bool | canMake (const Unit *builder, UnitType type)=0 |
virtual bool | canResearch (const Unit *unit, TechType type)=0 |
virtual bool | canUpgrade (const Unit *unit, UpgradeType type)=0 |
virtual std::set< TilePosition > & | getStartLocations ()=0 |
virtual void | printf (const char *format,...)=0 |
virtual void | sendText (const char *format,...)=0 |
virtual void | sendTextEx (bool toAllies, const char *format,...)=0 |
virtual void | changeRace (Race race)=0 |
virtual bool | isInGame ()=0 |
virtual bool | isMultiplayer ()=0 |
virtual bool | isBattleNet ()=0 |
virtual bool | isPaused ()=0 |
virtual bool | isReplay ()=0 |
virtual void | startGame ()=0 |
virtual void | pauseGame ()=0 |
virtual void | resumeGame ()=0 |
virtual void | leaveGame ()=0 |
virtual void | restartGame ()=0 |
virtual void | setLocalSpeed (int speed=-1)=0 |
virtual bool | issueCommand (const std::set< BWAPI::Unit * > &units, UnitCommand command)=0 |
virtual std::set< Unit * > & | getSelectedUnits ()=0 |
virtual Player * | self ()=0 |
virtual Player * | enemy ()=0 |
virtual Player * | neutral ()=0 |
virtual std::set < BWAPI::Player * > & | allies ()=0 |
virtual std::set < BWAPI::Player * > & | enemies ()=0 |
virtual std::set < BWAPI::Player * > & | observers ()=0 |
virtual void | setTextSize (int size=1)=0 |
virtual void | drawText (int ctype, int x, int y, const char *format,...)=0 |
virtual void | drawTextMap (int x, int y, const char *format,...)=0 |
virtual void | drawTextMouse (int x, int y, const char *format,...)=0 |
virtual void | drawTextScreen (int x, int y, const char *format,...)=0 |
virtual void | drawBox (int ctype, int left, int top, int right, int bottom, Color color, bool isSolid=false)=0 |
virtual void | drawBoxMap (int left, int top, int right, int bottom, Color color, bool isSolid=false)=0 |
virtual void | drawBoxMouse (int left, int top, int right, int bottom, Color color, bool isSolid=false)=0 |
virtual void | drawBoxScreen (int left, int top, int right, int bottom, Color color, bool isSolid=false)=0 |
virtual void | drawTriangle (int ctype, int ax, int ay, int bx, int by, int cx, int cy, Color color, bool isSolid=false)=0 |
virtual void | drawTriangleMap (int ax, int ay, int bx, int by, int cx, int cy, Color color, bool isSolid=false)=0 |
virtual void | drawTriangleMouse (int ax, int ay, int bx, int by, int cx, int cy, Color color, bool isSolid=false)=0 |
virtual void | drawTriangleScreen (int ax, int ay, int bx, int by, int cx, int cy, Color color, bool isSolid=false)=0 |
virtual void | drawCircle (int ctype, int x, int y, int radius, Color color, bool isSolid=false)=0 |
virtual void | drawCircleMap (int x, int y, int radius, Color color, bool isSolid=false)=0 |
virtual void | drawCircleMouse (int x, int y, int radius, Color color, bool isSolid=false)=0 |
virtual void | drawCircleScreen (int x, int y, int radius, Color color, bool isSolid=false)=0 |
virtual void | drawEllipse (int ctype, int x, int y, int xrad, int yrad, Color color, bool isSolid=false)=0 |
virtual void | drawEllipseMap (int x, int y, int xrad, int yrad, Color color, bool isSolid=false)=0 |
virtual void | drawEllipseMouse (int x, int y, int xrad, int yrad, Color color, bool isSolid=false)=0 |
virtual void | drawEllipseScreen (int x, int y, int xrad, int yrad, Color color, bool isSolid=false)=0 |
virtual void | drawDot (int ctype, int x, int y, Color color)=0 |
virtual void | drawDotMap (int x, int y, Color color)=0 |
virtual void | drawDotMouse (int x, int y, Color color)=0 |
virtual void | drawDotScreen (int x, int y, Color color)=0 |
virtual void | drawLine (int ctype, int x1, int y1, int x2, int y2, Color color)=0 |
virtual void | drawLineMap (int x1, int y1, int x2, int y2, Color color)=0 |
virtual void | drawLineMouse (int x1, int y1, int x2, int y2, Color color)=0 |
virtual void | drawLineScreen (int x1, int y1, int x2, int y2, Color color)=0 |
virtual void * | getScreenBuffer ()=0 |
virtual int | getLatencyFrames ()=0 |
virtual int | getLatencyTime ()=0 |
virtual int | getRemainingLatencyFrames ()=0 |
virtual int | getRemainingLatencyTime ()=0 |
virtual int | getRevision ()=0 |
virtual bool | isDebug ()=0 |
virtual bool | isLatComEnabled ()=0 |
virtual void | setLatCom (bool isEnabled)=0 |
virtual int | getReplayFrameCount ()=0 |
virtual void | setGUI (bool enabled=true)=0 |
virtual int | getInstanceNumber ()=0 |
virtual int | getAPM (bool includeSelects=false)=0 |
virtual bool | setMap (const char *mapFileName)=0 |
virtual void | setFrameSkip (int frameSkip=1)=0 |
virtual bool | hasPath (Position source, Position destination) const =0 |
virtual bool | setAlliance (BWAPI::Player *player, bool allied=true, bool alliedVictory=true)=0 |
virtual bool | setVision (BWAPI::Player *player, bool enabled=true)=0 |
virtual int | elapsedTime () const =0 |
virtual void | setCommandOptimizationLevel (int level=2)=0 |
The abstract Game class is implemented by BWAPI and offers many methods for retrieving information about the current Broodwar game, including the set of players, units, map information, as well as information about the user, such as mouse position, screen position, and the current selection of units.
virtual std::set<BWAPI::Player*>& BWAPI::Game::allies | ( | ) | [pure virtual] |
Returns a set of all the ally players that have not left or been defeated. Does not include self.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::canBuildHere | ( | const Unit * | builder, |
TilePosition | position, | ||
UnitType | type, | ||
bool | checkExplored = false |
||
) | [pure virtual] |
Returns true if the given unit type can be built at the given build tile position. Note the tile position specifies the top left tile of the building. If builder is not null, the unit will be discarded when determining whether or not any ground units are blocking the build location.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::canMake | ( | const Unit * | builder, |
UnitType | type | ||
) | [pure virtual] |
Returns true if the AI player has enough resources, supply, tech, and required units in order to make the given unit type. If builder is not null, canMake will return true only if the builder unit can build the given unit type.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::canResearch | ( | const Unit * | unit, |
TechType | type | ||
) | [pure virtual] |
Returns true if the AI player has enough resources required to research the given tech type. If unit is not null, canResearch will return true only if the given unit can research the given tech type.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::canUpgrade | ( | const Unit * | unit, |
UpgradeType | type | ||
) | [pure virtual] |
Returns true if the AI player has enough resources required to upgrade the given upgrade type. If unit is not null, canUpgrade will return true only if the given unit can upgrade the given upgrade type.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::changeRace | ( | Race | race | ) | [pure virtual] |
Used to change the race while in a lobby. Note that there is no onLobbyEnter callback yet, so this function cannot be used at this time.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawBox | ( | int | ctype, |
int | left, | ||
int | top, | ||
int | right, | ||
int | bottom, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Draws a box on the screen, with the given color. If isSolid is true, the entire box will be rendered, otherwise just the outline will be drawn.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawBoxMap | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawBoxMouse | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawBoxScreen | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawCircle | ( | int | ctype, |
int | x, | ||
int | y, | ||
int | radius, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Draws a circle on the screen, with the given color. If isSolid is true, a solid circle is drawn, otherwise just the outline of a circle will be drawn.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawCircleMap | ( | int | x, |
int | y, | ||
int | radius, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawCircleMouse | ( | int | x, |
int | y, | ||
int | radius, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawCircleScreen | ( | int | x, |
int | y, | ||
int | radius, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawDot | ( | int | ctype, |
int | x, | ||
int | y, | ||
Color | color | ||
) | [pure virtual] |
Draws a dot on the screen at the given position with the given color.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawDotMap | ( | int | x, |
int | y, | ||
Color | color | ||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawDotMouse | ( | int | x, |
int | y, | ||
Color | color | ||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawDotScreen | ( | int | x, |
int | y, | ||
Color | color | ||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawEllipse | ( | int | ctype, |
int | x, | ||
int | y, | ||
int | xrad, | ||
int | yrad, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Draws an ellipse on the screen, with the given color. If isSolid is true, a solid ellipse is drawn, otherwise just the outline of an ellipse will be drawn.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawEllipseMap | ( | int | x, |
int | y, | ||
int | xrad, | ||
int | yrad, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawEllipseMouse | ( | int | x, |
int | y, | ||
int | xrad, | ||
int | yrad, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawEllipseScreen | ( | int | x, |
int | y, | ||
int | xrad, | ||
int | yrad, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawLine | ( | int | ctype, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
Color | color | ||
) | [pure virtual] |
Draws a line on the screen from (x1,y1) to (x2,y2) with the given color.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawLineMap | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
Color | color | ||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawLineMouse | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
Color | color | ||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawLineScreen | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
Color | color | ||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawText | ( | int | ctype, |
int | x, | ||
int | y, | ||
const char * | format, | ||
... | |||
) | [pure virtual] |
Draws text on the screen at the given position. Text can be drawn in different colors by using the following control characters: TODO: add image from wiki.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawTextMap | ( | int | x, |
int | y, | ||
const char * | format, | ||
... | |||
) | [pure virtual] |
virtual void BWAPI::Game::drawTextMouse | ( | int | x, |
int | y, | ||
const char * | format, | ||
... | |||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawTextScreen | ( | int | x, |
int | y, | ||
const char * | format, | ||
... | |||
) | [pure virtual] |
virtual void BWAPI::Game::drawTriangle | ( | int | ctype, |
int | ax, | ||
int | ay, | ||
int | bx, | ||
int | by, | ||
int | cx, | ||
int | cy, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Draws a triangle on the screen. If isSolid is true, a solid triangle is drawn, otherwise just the outline of the triangle will be drawn.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawTriangleMap | ( | int | ax, |
int | ay, | ||
int | bx, | ||
int | by, | ||
int | cx, | ||
int | cy, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawTriangleMouse | ( | int | ax, |
int | ay, | ||
int | bx, | ||
int | by, | ||
int | cx, | ||
int | cy, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::drawTriangleScreen | ( | int | ax, |
int | ay, | ||
int | bx, | ||
int | by, | ||
int | cx, | ||
int | cy, | ||
Color | color, | ||
bool | isSolid = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::elapsedTime | ( | ) | const [pure virtual] |
Returns the elapsed game time in seconds.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::enableFlag | ( | int | flag | ) | [pure virtual] |
Enables the specified flag. Note that flags can only be enabled at the beginning of a match, during the AIModule::onStart callback.
Implemented in BWAPI::GameImpl.
virtual std::set<BWAPI::Player*>& BWAPI::Game::enemies | ( | ) | [pure virtual] |
Returns a set of all the enemy players that have not left or been defeated.
Implemented in BWAPI::GameImpl.
virtual Player* BWAPI::Game::enemy | ( | ) | [pure virtual] |
Returns a pointer to the enemy player. If there is more than one enemy, this returns a pointer to just one enemy (see enemies to get all enemies still in game). In replays this will return NULL.
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getAllUnits | ( | ) | [pure virtual] |
Returns all the visible units. If Flag::CompleteMapInformation is enabled, the set of all units is returned, not just visible ones. Note that units inside refineries are not included in this set yet.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getAPM | ( | bool | includeSelects = false | ) | [pure virtual] |
Retrieves the bot's APM. Can include or exclude select commands.
Implemented in BWAPI::GameImpl.
virtual double BWAPI::Game::getAverageFPS | ( | ) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual std::set< Bullet* >& BWAPI::Game::getBullets | ( | ) | [pure virtual] |
Returns all visible bullets. If Flag::CompleteMapInformation is enabled, the set of all bullets is returned, not just visible ones.
Implemented in BWAPI::GameImpl.
virtual std::list< Event >& BWAPI::Game::getEvents | ( | ) | [pure virtual] |
Returns the list of events
Implemented in BWAPI::GameImpl.
virtual Force* BWAPI::Game::getForce | ( | int | forceID | ) | [pure virtual] |
Returns the force with the given ID, or NULL if no force has the given ID
Implemented in BWAPI::GameImpl.
virtual std::set< Force* >& BWAPI::Game::getForces | ( | ) | [pure virtual] |
Returns the set of all forces in the match.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getFPS | ( | ) | [pure virtual] |
Returns the Frames Per Second (FPS) that the game is currently running at
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getFrameCount | ( | ) | [pure virtual] |
Returns the number of logical frames since the match started. If the game is paused, Game::getFrameCount will not increase however AIModule::onFrame will still be called while paused. On Fastest, there are about 23.8 - 24 frames per second.
Implemented in BWAPI::GameImpl.
virtual GameType BWAPI::Game::getGameType | ( | ) | [pure virtual] |
Returns the game type
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getGeysers | ( | ) | [pure virtual] |
Returns the set of all accessible vespene geysers.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getGroundHeight | ( | int | tileX, |
int | tileY | ||
) | [pure virtual] |
Returns the ground height of the given build tile. 0 = normal, 1 = high ground. 2 = very high ground.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getGroundHeight | ( | TilePosition | position | ) | [pure virtual] |
Returns the ground height of the given build tile. 0 = normal, 1 = high ground. 2 = very high ground.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getInstanceNumber | ( | ) | [pure virtual] |
Retrieves the instance number recorded by BWAPI to identify which instance an AI module belongs to
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::getKeyState | ( | Key | key | ) | [pure virtual] |
Returns true if the specified key is pressed. Returns false if Flag::UserInput is disabled. Unfortunately this does not read the raw keyboard input yet - when you hold down a key, the getKeyState function is true for a frame, then false for a few frames, and then alternates between true and false (as if you were holding down the key in a text box). Hopefully this will be fixed in a later version.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::getKeyState | ( | int | key | ) | [pure virtual] |
Returns true if the specified key is pressed. Returns false if Flag::UserInput is disabled. Unfortunately this does not read the raw keyboard input yet - when you hold down a key, the getKeyState function is true for a frame, then false for a few frames, and then alternates between true and false (as if you were holding down the key in a text box). Hopefully this will be fixed in a later version.
Implemented in BWAPI::GameImpl.
virtual Error BWAPI::Game::getLastError | ( | ) | const [pure virtual] |
Returns the last error that was set. If you try to order enemy units around, or morph bunkers into lurkers, BWAPI will set error codes, which can be retrieved using this function.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getLatency | ( | ) | [pure virtual] |
Returns the amount of latency the current game has. Currently only returns Latency::SinglePlayer, Latency::LanLow, Latency::LanMedium, or Latency::LanHigh.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getLatencyFrames | ( | ) | [pure virtual] |
Retrieves latency values for the game. Includes latency, speed, and mode
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getLatencyTime | ( | ) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getMinerals | ( | ) | [pure virtual] |
Returns the set of all accessible mineral patches.
Implemented in BWAPI::GameImpl.
virtual BWAPI::Position BWAPI::Game::getMousePosition | ( | ) | [pure virtual] |
Returns the position of the mouse on the screen. Returns Positions::Unknown if Flag::UserInput is disabled.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::getMouseState | ( | MouseButton | button | ) | [pure virtual] |
Returns true if the specified mouse button is pressed. Returns false if Flag::UserInput is disabled.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::getMouseState | ( | int | button | ) | [pure virtual] |
Returns true if the specified mouse button is pressed. Returns false if Flag::UserInput is disabled.
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getNeutralUnits | ( | ) | [pure virtual] |
Returns the set of all accessible neutral units.
Implemented in BWAPI::GameImpl.
virtual std::set< Position >& BWAPI::Game::getNukeDots | ( | ) | [pure virtual] |
Returns all visible nuke dots. If Flag::CompleteMapInformation is enabled, the set of all nuke dots is returned, not just visible ones.
Implemented in BWAPI::GameImpl.
virtual Player* BWAPI::Game::getPlayer | ( | int | playerID | ) | [pure virtual] |
Returns the player with the given ID, or NULL if no player has the given ID
Implemented in BWAPI::GameImpl.
virtual std::set< Player* >& BWAPI::Game::getPlayers | ( | ) | [pure virtual] |
Returns the set of all players in the match. Note that this includes the Neutral player, which owns all the neutral units such as minerals, critters, etc.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getRemainingLatencyFrames | ( | ) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getRemainingLatencyTime | ( | ) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getReplayFrameCount | ( | ) | [pure virtual] |
Retrieves the number of frames in the replay
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::getRevision | ( | ) | [pure virtual] |
Retrieves the current revision of BWAPI.
Implemented in BWAPI::GameImpl.
virtual void* BWAPI::Game::getScreenBuffer | ( | ) | [pure virtual] |
Retrieves the screen buffer for the game (excluding the HUD)
Implemented in BWAPI::GameImpl.
virtual BWAPI::Position BWAPI::Game::getScreenPosition | ( | ) | [pure virtual] |
Returns the position of the top left corner of the screen on the map. Returns Positions::Unknown if Flag::UserInput is disabled.
Implemented in BWAPI::GameImpl.
virtual std::set<Unit*>& BWAPI::Game::getSelectedUnits | ( | ) | [pure virtual] |
Returns the set of units currently selected by the user in the GUI. If Flag?::UserInput? was not enabled during the AIModule::onStart callback, this function will always return an empty set.
Implemented in BWAPI::GameImpl.
virtual std::set< TilePosition >& BWAPI::Game::getStartLocations | ( | ) | [pure virtual] |
Returns the set of starting locations for the given map. To determine the starting location for the players in the current match, see Player::getStartLocation.
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getStaticGeysers | ( | ) | [pure virtual] |
Returns the set of all vespene geysers (including mined out and other inaccessible ones).
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getStaticMinerals | ( | ) | [pure virtual] |
Returns the set of all mineral patches (including mined out and other inaccessible ones).
Implemented in BWAPI::GameImpl.
virtual std::set< Unit* >& BWAPI::Game::getStaticNeutralUnits | ( | ) | [pure virtual] |
Returns the set of all neutral units (including mined out and other inaccessible ones).
Implemented in BWAPI::GameImpl.
virtual Unit* BWAPI::Game::getUnit | ( | int | unitID | ) | [pure virtual] |
Returns the unit with the given ID, or NULL if no unit has the given ID
Implemented in BWAPI::GameImpl.
virtual std::set<Unit*>& BWAPI::Game::getUnitsInRadius | ( | BWAPI::Position | center, |
int | radius | ||
) | const [pure virtual] |
Returns the set of accessible units within or overlapping a circle at the given point with the given radius.
Implemented in BWAPI::GameImpl.
virtual std::set<Unit*>& BWAPI::Game::getUnitsInRectangle | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) | const [pure virtual] |
Returns the set of accessible units that are in or overlapping the given rectangle.
Implemented in BWAPI::GameImpl.
virtual std::set<Unit*>& BWAPI::Game::getUnitsInRectangle | ( | BWAPI::Position | topLeft, |
BWAPI::Position | bottomRight | ||
) | const [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual std::set<Unit*>& BWAPI::Game::getUnitsOnTile | ( | int | tileX, |
int | tileY | ||
) | [pure virtual] |
Returns the set of accessible units that are on the given build tile.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasCreep | ( | int | tileX, |
int | tileY | ||
) | [pure virtual] |
Returns true if the specified build tile has zerg creep on it. If the tile is concealed by fog of war, the function will return false.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasCreep | ( | TilePosition | position | ) | [pure virtual] |
Returns true if the specified build tile has zerg creep on it. If the tile is concealed by fog of war, the function will return false.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPath | ( | Position | source, |
Position | destination | ||
) | const [pure virtual] |
Returns true if Starcraft can find a path from the source to the destination.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPower | ( | int | tileX, |
int | tileY, | ||
UnitType | unitType = UnitTypes::None |
||
) | const [pure virtual] |
Returns true if the given build location is powered by a nearby friendly pylon.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPower | ( | TilePosition | position, |
UnitType | unitType = UnitTypes::None |
||
) | const [pure virtual] |
Returns true if the given build location is powered by a nearby friendly pylon.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPower | ( | int | tileX, |
int | tileY, | ||
int | tileWidth, | ||
int | tileHeight, | ||
UnitType | unitType = UnitTypes::None |
||
) | const [pure virtual] |
Returns true if the given build location is powered by a nearby friendly pylon.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPower | ( | TilePosition | position, |
int | tileWidth, | ||
int | tileHeight, | ||
UnitType | unitType = UnitTypes::None |
||
) | const [pure virtual] |
Returns true if the given build location is powered by a nearby friendly pylon.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPowerPrecise | ( | int | x, |
int | y, | ||
UnitType | unitType = UnitTypes::None |
||
) | const [pure virtual] |
Returns true if the given pixel location is powered by a nearby friendly pylon.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::hasPowerPrecise | ( | Position | position, |
UnitType | unitType = UnitTypes::None |
||
) | const [pure virtual] |
Returns true if the given pixel location is powered by a nearby friendly pylon.
Implemented in BWAPI::GameImpl.
virtual Unit* BWAPI::Game::indexToUnit | ( | int | unitIndex | ) | [pure virtual] |
Returns a pointer to a Unit given an index.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isBattleNet | ( | ) | [pure virtual] |
Returns true if Broodwar is in a BNet multiplayer game.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isBuildable | ( | int | tileX, |
int | tileY, | ||
bool | includeBuildings = false |
||
) | [pure virtual] |
Returns true if the specified build tile is buildable. Note that this just uses the static map data. You will also need to make sure no ground units on the tile to see if its currently buildable. To do this, see unitsOnTile.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isBuildable | ( | TilePosition | position, |
bool | includeBuildings = false |
||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isDebug | ( | ) | [pure virtual] |
Retrieves the debug state of the BWAPI build.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isExplored | ( | int | tileX, |
int | tileY | ||
) | [pure virtual] |
Returns true if the specified build tile has been explored (i.e. was visible at some point in the match).
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isExplored | ( | TilePosition | position | ) | [pure virtual] |
Returns true if the specified build tile has been explored (i.e. was visible at some point in the match).
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isFlagEnabled | ( | int | flag | ) | [pure virtual] |
Returns true if the given flag has been enabled. Note that flags can only be enabled at the beginning of a match, during the AIModule::onStart callback.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isInGame | ( | ) | [pure virtual] |
Returns true if Broodwar is in a game. Returns false for lobby and menu screens
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isLatComEnabled | ( | ) | [pure virtual] |
Returns true if latency compensation is enabled
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isMultiplayer | ( | ) | [pure virtual] |
Returns true if Broodwar is in a multiplayer game. Returns false for single player games and replays.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isPaused | ( | ) | [pure virtual] |
Returns true if Broodwar is paused. If the game is paused, Game::getFrameCount will continue to increase and AIModule::onFrame will still be called while paused.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isReplay | ( | ) | [pure virtual] |
Returns true if Broodwar is in a replay.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::issueCommand | ( | const std::set< BWAPI::Unit * > & | units, |
UnitCommand | command | ||
) | [pure virtual] |
Issues a command to a group of units
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isVisible | ( | int | tileX, |
int | tileY | ||
) | [pure virtual] |
Returns true if the specified build tile is visible. If the tile is concealed by fog of war, the function will return false.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isVisible | ( | TilePosition | position | ) | [pure virtual] |
Returns true if the specified build tile is visible. If the tile is concealed by fog of war, the function will return false.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::isWalkable | ( | int | walkX, |
int | walkY | ||
) | [pure virtual] |
Returns true if the specified walk tile is walkable. The values of x and y are in walk tile coordinates (different from build tile coordinates). Note that this just uses the static map data. You will also need to make sure no ground units are on the coresponding build tile to see if its currently walkable. To do this, see unitsOnTile.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::leaveGame | ( | ) | [pure virtual] |
Leaves the current match and goes to the after-game stats screen.
Implemented in BWAPI::GameImpl.
virtual std::string BWAPI::Game::mapFileName | ( | ) | [pure virtual] |
Returns the file name of the current map.
Implemented in BWAPI::GameImpl.
virtual std::string BWAPI::Game::mapHash | ( | ) | [pure virtual] |
Returns the SHA-1 hash of the map file.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::mapHeight | ( | ) | [pure virtual] |
Returns the height of the current map, in build tile units. To get the height of the current map in walk tile units, multiply by 4. To get the height of the current map in Position units, multiply by TILE_SIZE (which is 32).
Implemented in BWAPI::GameImpl.
virtual std::string BWAPI::Game::mapName | ( | ) | [pure virtual] |
Returns the name/title of the current map.
Implemented in BWAPI::GameImpl.
virtual std::string BWAPI::Game::mapPathName | ( | ) | [pure virtual] |
Returns the full path name of the current map.
Implemented in BWAPI::GameImpl.
virtual int BWAPI::Game::mapWidth | ( | ) | [pure virtual] |
Returns the width of the current map, in build tile units. To get the width of the current map in walk tile units, multiply by 4. To get the width of the current map in Position units, multiply by TILE_SIZE (which is 32).
Implemented in BWAPI::GameImpl.
virtual Player* BWAPI::Game::neutral | ( | ) | [pure virtual] |
Returns a pointer to the neutral player.
Implemented in BWAPI::GameImpl.
virtual std::set<BWAPI::Player*>& BWAPI::Game::observers | ( | ) | [pure virtual] |
Returns a set of all the observer players that have not left.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::pauseGame | ( | ) | [pure virtual] |
Pauses the game. If the game is paused, Game::getFrameCount will not increase however AIModule::onFrame will still be called while paused.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::pingMinimap | ( | int | x, |
int | y | ||
) | [pure virtual] |
Pings the given position on the minimap.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::pingMinimap | ( | BWAPI::Position | p | ) | [pure virtual] |
Pings the given position on the minimap.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::printf | ( | const char * | format, |
... | |||
) | [pure virtual] |
Prints text on the screen. Text is not sent to other players in multiplayer games.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::restartGame | ( | ) | [pure virtual] |
Restarts the match. Works the same way as if you restarted the match from the menu screen. Only available in single player mode.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::resumeGame | ( | ) | [pure virtual] |
Resumes the game.
Implemented in BWAPI::GameImpl.
virtual Player* BWAPI::Game::self | ( | ) | [pure virtual] |
Returns a pointer to the player that BWAPI controls. In replays this will return null.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::sendText | ( | const char * | format, |
... | |||
) | [pure virtual] |
Sends text to other players - as if it were entered in chat. In single player games and replays, this will just print the text on the screen. If the game is a single player match and not a replay, then this function can be used to execute cheat codes, i.e. Broodwar->sendText("show me the money").
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::sendTextEx | ( | bool | toAllies, |
const char * | format, | ||
... | |||
) | [pure virtual] |
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::setAlliance | ( | BWAPI::Player * | player, |
bool | allied = true , |
||
bool | alliedVictory = true |
||
) | [pure virtual] |
Sets the BWAPI player's alliance with another player.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setCommandOptimizationLevel | ( | int | level = 2 | ) | [pure virtual] |
Sets the level of command optimizations. 0 = No optimization. 1 = Some optimization (Stop, Hold Position, Siege, Burrow, etc.). 2 = More optimization (Train, Set Rally, Lift, [multi-select buildings]). 3 = Maximum optimization (Attack/Move to position, use ability at position, etc.).
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setFrameSkip | ( | int | frameSkip = 1 | ) | [pure virtual] |
Sets the frame skip value. 1 = normal
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setGUI | ( | bool | enabled = true | ) | [pure virtual] |
Sets the rendering state of the Starcraft GUI
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::setLastError | ( | BWAPI::Error | e | ) | [pure virtual] |
Sets the last error code.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setLatCom | ( | bool | isEnabled | ) | [pure virtual] |
Use to enable or disable latency compensation. Default: Enabled
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setLocalSpeed | ( | int | speed = -1 | ) | [pure virtual] |
Sets the speed of the game to the given number. Lower numbers are faster. 0 is the fastest speed StarCraft can handle (which is about as fast as the fastest speed you can view a replay at). Any negative value will reset the speed to the StarCraft default.
Implemented in BWAPI::GameImpl.
virtual bool BWAPI::Game::setMap | ( | const char * | mapFileName | ) | [pure virtual] |
Changes the map to the one specified. Changes do not take effect unless the game is restarted.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setScreenPosition | ( | int | x, |
int | y | ||
) | [pure virtual] |
Moves the screen to the given position on the map. The position specified where the top left corner of the screen will be.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setScreenPosition | ( | BWAPI::Position | p | ) | [pure virtual] |
Moves the screen to the given position on the map. The position specified where the top left corner of the screen will be.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::setTextSize | ( | int | size = 1 | ) | [pure virtual] |
virtual bool BWAPI::Game::setVision | ( | BWAPI::Player * | player, |
bool | enabled = true |
||
) | [pure virtual] |
Sets the BWAPI player's vision with another player.
Implemented in BWAPI::GameImpl.
virtual void BWAPI::Game::startGame | ( | ) | [pure virtual] |
Used to start the game while in a lobby. Note that there is no onLobbyEnter callback yet, so this function cannot be used at this time.
Implemented in BWAPI::GameImpl.