BWAPI  4.2.0
An API for interacting with Starcraft: Broodwar (1.16.1)
Public Member Functions | List of all members
BWAPI::RegionInterface Class Referenceabstract
Inheritance diagram for BWAPI::RegionInterface:
Inheritance graph

Public Member Functions

virtual int getBoundsBottom () const =0
virtual int getBoundsLeft () const =0
virtual int getBoundsRight () const =0
virtual int getBoundsTop () const =0
virtual BWAPI::Position getCenter () const =0
virtual BWAPI::Region getClosestAccessibleRegion () const =0
virtual BWAPI::Region getClosestInaccessibleRegion () const =0
virtual int getDefensePriority () const =0
int getDistance (BWAPI::Region other) const
virtual int getID () const =0
virtual const RegionsetgetNeighbors () const =0
virtual int getRegionGroupID () const =0
Unitset getUnits (const UnitFilter &pred=nullptr) const
virtual bool isAccessible () const =0
virtual bool isHigherGround () const =0

Detailed Description

Region objects are created by Starcraft: Broodwar to contain several tiles with the same properties, and create a node in pathfinding and other algorithms.

Regions may not contain detailed information, but have a sufficient amount of data to identify general chokepoints, accessibility to neighboring terrain, be used in general pathing algorithms, and used as nodes to rally units to.

Most parameters that are available are explicitly assigned by Broodwar itself.

See also
Game::getAllRegions, Game::getRegionAt, UnitInterface::getRegion

Member Function Documentation

virtual int BWAPI::RegionInterface::getID () const pure virtual

Retrieves a unique identifier for this region.

Note
This identifier is explicitly assigned by Broodwar.
Returns
An integer that represents this region.
See also
Game::getRegion
virtual int BWAPI::RegionInterface::getRegionGroupID () const pure virtual

Retrieves a unique identifier for a group of regions that are all connected and accessible by each other.

That is, all accessible regions will have the same group ID. This function is generally used to check if a path is available between two points in constant time.

Note
This identifier is explicitly assigned by Broodwar.
Returns
An integer that represents the group of regions that this one is attached to.
virtual BWAPI::Position BWAPI::RegionInterface::getCenter () const pure virtual

Retrieves the center of the region.

This position is used as the node of the region.

Returns
A Position indicating the center location of the Region, in pixels.
virtual bool BWAPI::RegionInterface::isHigherGround () const pure virtual

Checks if this region is part of higher ground.

Higher ground may be used in strategic placement of units and structures.

Returns
true if this region is part of strategic higher ground, and false otherwise.
virtual int BWAPI::RegionInterface::getDefensePriority () const pure virtual

Retrieves a value that represents the strategic advantage of this region relative to other regions.

A value of 2 may indicate a possible choke point, and a value of 3 indicates a signficant strategic position.

Note
This value is explicitly assigned by Broodwar.
Returns
An integer indicating this region's strategic potential.
virtual bool BWAPI::RegionInterface::isAccessible () const pure virtual

Retrieves the state of accessibility of the region.

The region is considered accessible if it can be accessed by ground units.

Returns
true if ground units can traverse this region, and false if the tiles in this region are inaccessible or unwalkable.
virtual const Regionset& BWAPI::RegionInterface::getNeighbors () const pure virtual

Retrieves the set of neighbor Regions that this one is connected to.

Returns
A reference to a Regionset containing the neighboring Regions.
virtual int BWAPI::RegionInterface::getBoundsLeft () const pure virtual

Retrieves the approximate left boundary of the region.

Returns
The x coordinate, in pixels, of the approximate left boundary of the region.
virtual int BWAPI::RegionInterface::getBoundsTop () const pure virtual

Retrieves the approximate top boundary of the region.

Returns
The y coordinate, in pixels, of the approximate top boundary of the region.
virtual int BWAPI::RegionInterface::getBoundsRight () const pure virtual

Retrieves the approximate right boundary of the region.

Returns
The x coordinate, in pixels, of the approximate right boundary of the region.
virtual int BWAPI::RegionInterface::getBoundsBottom () const pure virtual

Retrieves the approximate bottom boundary of the region.

Returns
The y coordinate, in pixels, of the approximate bottom boundary of the region.
virtual BWAPI::Region BWAPI::RegionInterface::getClosestAccessibleRegion () const pure virtual

Retrieves the closest accessible neighbor region.

Returns
The closest Region that is accessible.
virtual BWAPI::Region BWAPI::RegionInterface::getClosestInaccessibleRegion () const pure virtual

Retrieves the closest inaccessible neighbor region.

Returns
The closest Region that is inaccessible.
int BWAPI::RegionInterface::getDistance (BWAPI::Region other) const

Retrieves the center-to-center distance between two regions.

Note
Ignores all collisions.
Parameters
otherThe target Region to calculate distance to.
Returns
The integer distance from this Region to other.
Unitset BWAPI::RegionInterface::getUnits (const UnitFilterpred = nullptr) const

Retrieves a Unitset containing all the units that are in this region.

Also has the ability to filter the units before the creation of the Unitset.

Parameters
pred(optional) If this parameter is used, it is a UnitFilter or function predicate that will retrieve only the units whose attributes match the given criteria. If omitted, then a default value of nullptr is used, in which case there is no filter.
Returns
A Unitset containing all units in this region that have met the requirements of pred.
See also
UnitFilter