![]() |
BTHAI 2.3
|
#include <ExplorationManager.h>
Public Member Functions | |
~ExplorationManager () | |
void | setInactive () |
bool | isActive () |
void | computeActions () |
TilePosition | getNextToExplore (Squad *squad) |
TilePosition | searchExpansionSite () |
TilePosition | getExpansionSite () |
void | setExpansionSite (TilePosition pos) |
void | printInfo () |
void | addSpottedUnit (Unit *unit) |
void | unitDestroyed (Unit *unit) |
vector< SpottedObject * > | getSpottedBuildings () |
TilePosition | getClosestSpottedBuilding (TilePosition start) |
int | spottedBuildingsWithinRange (TilePosition pos, int range) |
bool | buildingsSpotted () |
void | showIntellData () |
void | setExplored (TilePosition goal) |
TilePosition | scanForVulnerableBase () |
bool | isDetectorCovering (TilePosition pos) |
bool | isDetectorCovering (Position pos) |
Static Public Member Functions | |
static ExplorationManager * | getInstance () |
static bool | canReach (TilePosition a, TilePosition b) |
static bool | canReach (BaseAgent *agent, TilePosition b) |
static bool | enemyIsProtoss () |
static bool | enemyIsZerg () |
static bool | enemyIsTerran () |
static bool | enemyIsUnknown () |
The ExplorationManager handles all tasks involving exploration of the game world. It issue orders to a number of units that is used as explorers, keep track of areas recently explored, and keep track of spotted resources or enemy buildings.
The ExplorationManager is implemented as a singleton class. Each class that needs to access ExplorationManager can request an instance, and all classes shares the same ExplorationManager instance.
Author: Johan Hagelback (johan.hagelback@gmail.com)
ExplorationManager::~ExplorationManager | ( | ) |
Destructor
void ExplorationManager::addSpottedUnit | ( | Unit * | unit | ) |
Notifies about an enemy unit that has been spotted.
bool ExplorationManager::buildingsSpotted | ( | ) |
Returns true if any enemy buildings have been spotted.
bool ExplorationManager::canReach | ( | TilePosition | a, |
TilePosition | b | ||
) | [static] |
Returns true if a ground unit can reach position b from position a. Uses BWTA.
bool ExplorationManager::canReach | ( | BaseAgent * | agent, |
TilePosition | b | ||
) | [static] |
Returns true if an agent can reach position b.
void ExplorationManager::computeActions | ( | ) |
Called each update to issue orders.
bool ExplorationManager::enemyIsProtoss | ( | ) | [static] |
Returns true if an enemy is Protoss.
bool ExplorationManager::enemyIsTerran | ( | ) | [static] |
Returns true if an enemy is Terran.
bool ExplorationManager::enemyIsUnknown | ( | ) | [static] |
All enemy races are currently unknown.
bool ExplorationManager::enemyIsZerg | ( | ) | [static] |
Returns true if an enemy is Zerg.
TilePosition ExplorationManager::getClosestSpottedBuilding | ( | TilePosition | start | ) |
Returns the closest enemy spotted building from a start position, or TilePosition(-1,-1) if none was found.
TilePosition ExplorationManager::getExpansionSite | ( | ) |
Returns the next position to expand the base to.
ExplorationManager * ExplorationManager::getInstance | ( | ) | [static] |
Returns the instance of the class.
TilePosition ExplorationManager::getNextToExplore | ( | Squad * | squad | ) |
Returns the next position to explore for this squad.
vector< SpottedObject * > ExplorationManager::getSpottedBuildings | ( | ) |
Returns the list of spotted enemy buildings.
bool ExplorationManager::isActive | ( | ) |
Returns true if the ExplorationManager is active, false if not.
bool ExplorationManager::isDetectorCovering | ( | Position | pos | ) |
Checks if an enemy detector is covering the specified position.
bool ExplorationManager::isDetectorCovering | ( | TilePosition | pos | ) |
Checks if an enemy detector is covering the specified position.
void ExplorationManager::printInfo | ( | ) |
Shows all spotted objects as squares on the SC map. Use for debug purpose.
TilePosition ExplorationManager::scanForVulnerableBase | ( | ) |
Scans for vulnerable enemy bases, i.e. bases without protection from detectors.
TilePosition ExplorationManager::searchExpansionSite | ( | ) |
Searches for the next position to expand the base to.
void ExplorationManager::setExpansionSite | ( | TilePosition | pos | ) |
Sets the next position to expand the base to.
void ExplorationManager::setExplored | ( | TilePosition | goal | ) |
Sets that a region is explored. The position must be the TilePosition for the center of the region.
void ExplorationManager::setInactive | ( | ) |
Sets ExplorationManager to inactive. Is used when perfect information is activated.
void ExplorationManager::showIntellData | ( | ) |
Shows some data about the enemy on screen.
int ExplorationManager::spottedBuildingsWithinRange | ( | TilePosition | pos, |
int | range | ||
) |
Calculates the number of spotted enemy buildings within the specified range (in tiles).
void ExplorationManager::unitDestroyed | ( | Unit * | unit | ) |
Notifies that an enemy unit has been destroyed. If the destroyed unit was among the spotted units, it is removed from the list.