BWAPI
Public Member Functions | Static Public Member Functions | Static Public Attributes
CoverMap Class Reference

#include <CoverMap.h>

List of all members.

Public Member Functions

 ~CoverMap ()
void addConstructedBuilding (Unit *unit)
void fillTemp (UnitType toBuild, TilePosition buildSpot)
void clearTemp (UnitType toBuild, TilePosition buildSpot)
void buildingDestroyed (Unit *unit)
bool canBuild (UnitType toBuild, TilePosition buildSpot)
bool positionFree (TilePosition pos)
void blockPosition (TilePosition buildSpot)
TilePosition findBuildSpot (UnitType toBuild)
TilePosition findRefineryBuildSpot (UnitType toBuild, TilePosition start)
TilePosition findClosestGasWithoutRefinery (UnitType toBuild, TilePosition start)
TilePosition searchRefinerySpot ()
TilePosition findExpansionSite ()
void debug ()

Static Public Member Functions

static CoverMapgetInstance ()

Static Public Attributes

static const int BUILDABLE = 1
static const int BLOCKED = 0
static const int TEMPBLOCKED = 4
static const int MINERAL = 2
static const int GAS = 3

Detailed Description

The CoverMap class is used to keep track of the own base and which Tiles that are occupied by buildings, and which Tiles are free and possibly can be used to construct new buildings on.

Internally a matrix of the same size as the map is used. If a Tile is occupied or cant be reached by ground units, the value if the tile is 0. If the Tile can be built on, the value is 1. Buildings typically use up more space in the matrix than their actual size since we want some free space around each building. Different types of buildings have different space requirements.

The CoverMap is implemented as a singleton class. Each class that needs to access CoverMap can request an instance, and all classes shares the same CoverMap instance.

Author: Johan Hagelback (johan.hagelback@gmail.com)


Constructor & Destructor Documentation

Destructor


Member Function Documentation

Adds a newly constructed building to the cover map.

Here is the call graph for this function:

Blocks a position from being used as a valid buildSpot. Used when a worker is timedout when moving towards the buildSpot.

Here is the call graph for this function:

Here is the caller graph for this function:

Called when a building is destroyed, to free up the space.

Here is the call graph for this function:

bool CoverMap::canBuild ( UnitType  toBuild,
TilePosition  buildSpot 
)

Checks if the specified building type can be built at the buildSpot. True if it can, false otherwise.

Here is the call graph for this function:

void CoverMap::clearTemp ( UnitType  toBuild,
TilePosition  buildSpot 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void CoverMap::debug ( )

Shows debug info on screen.

Here is the call graph for this function:

void CoverMap::fillTemp ( UnitType  toBuild,
TilePosition  buildSpot 
)

Here is the caller graph for this function:

TilePosition CoverMap::findBuildSpot ( UnitType  toBuild)

Finds and returns a buildSpot for the specified building type. If no buildspot is found, a TilePosition(-1,-1) is returned.

Here is the call graph for this function:

Finds and returns the position of the closest free vespene gas around the specified start position. If no gas vein is found, a TilePosition(-1, -1) is returned.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a position of a suitable site for expansion, i.e. new bases.

Here is the call graph for this function:

Searches for the closest vespene gas that is not in use. If no gas is sighted, the ExplorationManager is queried.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the instance of the class.

Here is the caller graph for this function:

Checks if a position is free.

Here is the call graph for this function:

Searches for a spot to build a refinery at. Returns TilePosition(-1, -1) if no spot was found.

Here is the call graph for this function:


Member Data Documentation

const int CoverMap::BLOCKED = 0 [static]

Tile is blocked and cannot be built on.

const int CoverMap::BUILDABLE = 1 [static]

Tile is buildable.

const int CoverMap::GAS = 3 [static]

Tile contains a gas vein.

const int CoverMap::MINERAL = 2 [static]

Tile contains a mineral vein.

const int CoverMap::TEMPBLOCKED = 4 [static]

Tile is temporary blocked and cannot be built on.


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