Skip to content

Commit

Permalink
fixed bug where we'd defend enemy region on gas steal
Browse files Browse the repository at this point in the history
  • Loading branch information
davechurchill committed Sep 23, 2015
1 parent 740577c commit d0803ab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions UAlbertaBot/Source/CombatCommander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,22 @@ void CombatCommander::updateDefenseSquads()
return;
}

BWTA::BaseLocation * enemyBaseLocation = InformationManager::Instance().getMainBaseLocation(BWAPI::Broodwar->enemy());
BWTA::Region * enemyRegion = NULL;
if (enemyBaseLocation)
{
enemyRegion = BWTA::getRegion(enemyBaseLocation->getPosition());
}

// for each of our occupied regions
for (BWTA::Region * myRegion : InformationManager::Instance().getOccupiedRegions(BWAPI::Broodwar->self()))
{
// don't defend inside the enemy region, this will end badly when we are stealing gas
if (myRegion == enemyRegion)
{
continue;
}

BWAPI::Position regionCenter = myRegion->getCenter();
if (!regionCenter.isValid())
{
Expand Down

0 comments on commit d0803ab

Please sign in to comment.