Example #1
0
void GameCommander::setScoutUnits()
{
	//BWAPI::Broodwar->drawTextScreen(200, 300, "%d", int(_scoutUnits.size()));
	if (!_scoutUnits.empty())
	{
		BWAPI::Unit scout = *(_scoutUnits.begin());
		if (!scout->exists())
		{
			_scoutUnits.clear();
		}
	}

    // if we haven't set a scout unit, do it
    if (_scoutUnits.empty())// && !_initialScoutSet)
    {
        BWAPI::Unit supplyProvider = getFirstSupplyProvider();

		// if it exists
		if (supplyProvider)
		{
			// grab the closest worker to the supply provider to send to scout
			BWAPI::Unit workerScout = getClosestWorkerToTarget(supplyProvider->getPosition());

			// if we find a worker (which we should) add it to the scout units
			if (workerScout)
			{
                ScoutManager::Instance().setWorkerScout(workerScout);
				assignUnit(workerScout, _scoutUnits);
                //_initialScoutSet = true;
			}
		}
    }
}
void Commander::destroyUnit(BWAPI::Unit unit)
{
	// If its one of my units
	if(unit->getPlayer()->getID() == Broodwar->self()->getID())
	{
		for(auto i=pAllUnits.begin();i!=pAllUnits.end();i++)
		{
			if((*i)->getID() == unit->getID())
			{
				pAllUnits.erase(i);
				break;
			}
		}

		for(auto i=squads.begin();i!=squads.end();i++)
			(*i)->removeUnit(PUnit::get(unit));
	}
	else // If its one of my ennemy
	{
		for(auto i=oAllUnits.begin();i!=oAllUnits.end();i++)
		{
			if((*i)->getID() == unit->getID())
			{
				oAllUnits.erase(i);
				break;
			}
		}
	}
}
Example #3
0
void CombatCommander::StayPut() {

	Squad & stayPut = _squadData.getSquad("StayPut");
	// defend untill we have a science vessel
	if (_combatUnits.empty() || BWAPI::Broodwar->self()->allUnitCount(BWAPI::UnitTypes::Terran_Science_Vessel) == 1)
	{
		return;
	}

	for (auto & unit : _combatUnits)
	{
		// get every unit of a lower priority and put it into the defense squad
		if (!unit->getType().isWorker() && (unit->getType() != BWAPI::UnitTypes::Zerg_Overlord) && _squadData.canAssignUnitToSquad(unit, stayPut))
		{
			// if theres a bunker with room, go into it
			for (auto unit2 : BWAPI::Broodwar->self()->getUnits()){
				if ((*unit2).getType() == BWAPI::UnitTypes::Terran_Bunker){
					BWAPI::Unit bunker = BWAPI::Broodwar->getUnit((*unit2).getID());
					BWAPI::Unitset set = bunker->getLoadedUnits();
					if (set.size() < 4) {
						(*unit).rightClick(bunker);
					}
				}
			}
			// add units to squad
			_squadData.assignUnitToSquad(unit, stayPut);
		}
	}

	// fufill squad order
	SquadOrder mainAttackOrder(SquadOrderTypes::Defend, defensePos, 300, "Attack Enemy Base");
	stayPut.setSquadOrder(mainAttackOrder);
}
Example #4
0
void MedicManager::executeMicro(const BWAPI::Unitset & targets) 
{
	const BWAPI::Unitset & medics = getUnits();
    
	// create a set of all medic targets
	BWAPI::Unitset medicTargets;
    for (auto & unit : BWAPI::Broodwar->self()->getUnits())
    {
        if (unit->getHitPoints() < unit->getInitialHitPoints() && !unit->getType().isMechanical() && !unit->getType().isBuilding())
        {
            medicTargets.insert(unit);
        }
    }
    
    BWAPI::Unitset availableMedics(medics);

    // for each target, send the closest medic to heal it
    for (auto & target : medicTargets)
    {
        // only one medic can heal a target at a time
        if (target->isBeingHealed())
        {
            continue;
        }

        double closestMedicDist = std::numeric_limits<double>::infinity();
        BWAPI::Unit closestMedic = nullptr;

        for (auto & medic : availableMedics)
        {
            double dist = medic->getDistance(target);

            if (!closestMedic || (dist < closestMedicDist))
            {
                closestMedic = medic;
                closestMedicDist = dist;
            }
        }

        // if we found a medic, send it to heal the target
        if (closestMedic)
        {
            closestMedic->useTech(BWAPI::TechTypes::Healing, target);

            availableMedics.erase(closestMedic);
        }
        // otherwise we didn't find a medic which means they're all in use so break
        else
        {
            break;
        }
    }

    // the remaining medics should head to the squad order position
    for (auto & medic : availableMedics)
    {
        Micro::SmartAttackMove(medic, order.getPosition());
    }
}
Example #5
0
// When the next item in the _queue is a building, this checks to see if we should move to it
// This function is here as it needs to access prodction manager's reserved resources info
void ProductionManager::predictWorkerMovement(const Building & b)
{
    if (b.isGasSteal)
    {
        return;
    }

	// get a possible building location for the building
	if (!_haveLocationForThisBuilding)
	{
		_predictedTilePosition = BuildingManager::Instance().getBuildingLocation(b);
	}

	if (_predictedTilePosition != BWAPI::TilePositions::None)
	{
		_haveLocationForThisBuilding = true;
	}
	else
	{
		return;
	}
	
	// draw a box where the building will be placed
	int x1 = _predictedTilePosition.x * 32;
	int x2 = x1 + (b.type.tileWidth()) * 32;
	int y1 = _predictedTilePosition.y * 32;
	int y2 = y1 + (b.type.tileHeight()) * 32;
	if (Config::Debug::DrawWorkerInfo) 
    {
        BWAPI::Broodwar->drawBoxMap(x1, y1, x2, y2, BWAPI::Colors::Blue, false);
    }

	// where we want the worker to walk to
	BWAPI::Position walkToPosition		= BWAPI::Position(x1 + (b.type.tileWidth()/2)*32, y1 + (b.type.tileHeight()/2)*32);

	// compute how many resources we need to construct this building
	int mineralsRequired				= std::max(0, b.type.mineralPrice() - getFreeMinerals());
	int gasRequired						= std::max(0, b.type.gasPrice() - getFreeGas());

	// get a candidate worker to move to this location
	BWAPI::Unit moveWorker			= WorkerManager::Instance().getMoveWorker(walkToPosition);

	// Conditions under which to move the worker: 
	//		- there's a valid worker to move
	//		- we haven't yet assigned a worker to move to this location
	//		- the build position is valid
	//		- we will have the required resources by the time the worker gets there
	if (moveWorker && _haveLocationForThisBuilding && !_assignedWorkerForThisBuilding && (_predictedTilePosition != BWAPI::TilePositions::None) &&
		WorkerManager::Instance().willHaveResources(mineralsRequired, gasRequired, moveWorker->getDistance(walkToPosition)) )
	{
		// we have assigned a worker
		_assignedWorkerForThisBuilding = true;

		// tell the worker manager to move this worker
		WorkerManager::Instance().setMoveWorker(mineralsRequired, gasRequired, walkToPosition);
	}
}
Example #6
0
void WorkerData::setWorkerJob(BWAPI::Unit unit, enum WorkerJob job, BWAPI::Unit jobUnit)
{
	if (!unit) { return; }

	clearPreviousJob(unit);
	workerJobMap[unit] = job;

	if (job == Minerals)
	{
		// increase the number of workers assigned to this nexus
		depotWorkerCount[jobUnit] += 1;

		// set the mineral the worker is working on
		workerDepotMap[unit] = jobUnit;

        BWAPI::Unit mineralToMine = getMineralToMine(unit);
        workerMineralAssignment[unit] = mineralToMine;
        addToMineralPatch(mineralToMine, 1);

		// right click the mineral to start mining
		Micro::SmartRightClick(unit, mineralToMine);
	}
	else if (job == Gas)
	{
		// increase the count of workers assigned to this refinery
		refineryWorkerCount[jobUnit] += 1;

		// set the refinery the worker is working on
		workerRefineryMap[unit] = jobUnit;

		// right click the refinery to start harvesting
		Micro::SmartRightClick(unit, jobUnit);
	}
    else if (job == Repair)
    {
        // only SCVs can repair
        assert(unit->getType() == BWAPI::UnitTypes::Terran_SCV);

        // set the building the worker is to repair
        workerRepairMap[unit] = jobUnit;

        // start repairing 
        if (!unit->isRepairing())
        {
            Micro::SmartRepair(unit, jobUnit);
        }
    }
	else if (job == Scout)
	{

	}
    else if (job == Build)
    {
        BWAPI::Broodwar->printf("Setting worker job to build");
    }
}
Example #7
0
void OpprimoBot::onUnitShow(BWAPI::Unit unit)
{
    if (Broodwar->isReplay() || Broodwar->getFrameCount() <= 1) return;

    if (unit->getPlayer()->getID() != Broodwar->self()->getID())
    {
        if (!unit->getPlayer()->isNeutral() && !unit->getPlayer()->isAlly(Broodwar->self()))
        {
            ExplorationManager::getInstance()->addSpottedUnit(unit);
        }
    }
}
Example #8
0
// this function will check to see if all preconditions are met and then create a unit
void ProductionManager::create(BWAPI::Unit producer, BuildOrderItem & item) 
{
    if (!producer)
    {
        return;
    }

    MetaType t = item.metaType;

    // if we're dealing with a building
    if (t.isUnit() && t.getUnitType().isBuilding() 
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Lair 
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Hive
        && t.getUnitType() != BWAPI::UnitTypes::Zerg_Greater_Spire
        && !t.getUnitType().isAddon())
    {
        // send the building task to the building manager
        BuildingManager::Instance().addBuildingTask(t.getUnitType(), BWAPI::Broodwar->self()->getStartLocation(), item.isGasSteal);
    }
    else if (t.getUnitType().isAddon())
    {
        //BWAPI::TilePosition addonPosition(producer->getTilePosition().x + producer->getType().tileWidth(), producer->getTilePosition().y + producer->getType().tileHeight() - t.unitType.tileHeight());
        producer->buildAddon(t.getUnitType());
    }
    // if we're dealing with a non-building unit
    else if (t.isUnit()) 
    {
        // if the race is zerg, morph the unit
        if (t.getUnitType().getRace() == BWAPI::Races::Zerg) 
        {
            producer->morph(t.getUnitType());
        // if not, train the unit
        } 
        else 
        {
            producer->train(t.getUnitType());
        }
    }
    // if we're dealing with a tech research
    else if (t.isTech())
    {
        producer->research(t.getTechType());
    }
    else if (t.isUpgrade())
    {
        //Logger::Instance().log("Produce Upgrade: " + t.getName() + "\n");
        producer->upgrade(t.getUpgradeType());
    }
    else
    {	
		
    }
}
Example #9
0
void ExampleAIModule::onUnitMorph(BWAPI::Unit unit)
{
  if ( Broodwar->isReplay() )
  {
    // if we are in a replay, then we will print out the build order of the structures
    if ( unit->getType().isBuilding() && !unit->getPlayer()->isNeutral() )
    {
      int seconds = Broodwar->getFrameCount()/24;
      int minutes = seconds/60;
      seconds %= 60;
      Broodwar->sendText("%.2d:%.2d: %s morphs a %s", minutes, seconds, unit->getPlayer()->getName().c_str(), unit->getType().c_str());
    }
  }
}
Example #10
0
void OpprimoBot::onUnitCreate(BWAPI::Unit unit)
{
    if (unit->getPlayer()->getID() == Broodwar->self()->getID())
    {
        loop.addUnit(unit);
    }
}
Example #11
0
bool UnitUtil::IsCombatUnit(BWAPI::Unit unit)
{
    UAB_ASSERT(unit != nullptr, "Unit was null");
    if (!unit)
    {
        return false;
    }

    // no workers or buildings allowed
    if (unit && unit->getType().isWorker() || unit->getType().isBuilding())
    {
        return false;
    }

    // check for various types of combat units
    if (unit->getType().canAttack() || 
        unit->getType() == BWAPI::UnitTypes::Terran_Medic ||
        unit->getType() == BWAPI::UnitTypes::Protoss_High_Templar ||
        unit->getType() == BWAPI::UnitTypes::Protoss_Observer ||
        unit->isFlying() && unit->getType().spaceProvided() > 0)
    {
        return true;
    }
		
    return false;
}
Example #12
0
 void BuildUnit::setBuildUnit( BWAPI::Unit unit, BuildUnit* buildUnit )
 {
   // Sanity check
   if ( unit == NULL || buildUnit == NULL )
   {
     return;
   }
   unit->setClientInfo( buildUnit );
   buildUnit->m_unit = unit;
 }
Example #13
0
bool CheeseStrategies::StandardPlay::startUpgrade(BWAPI::UpgradeType upgrade) {
   UnitType upBuildingType = upgrade.whatUpgrades();

    if (Broodwar->self()->completedUnitCount(upBuildingType) == 0) {
        return false;
    }

    UnitSet myUnits = BWAPI::Broodwar->self()->getUnits();
    UnitSet::iterator it;

    BWAPI::Unit* upBuilding;

    for (it=myUnits.begin(); it!=myUnits.end(); it++) {
        if ((*it)->getType() == upBuildingType) {
            upBuilding = (*it);
        }
    }

    return upBuilding->upgrade(upgrade);
}
Example #14
0
void ProductionManager::performCommand(BWAPI::UnitCommandType t) 
{
	// if it is a cancel construction, it is probably the extractor trick
	if (t == BWAPI::UnitCommandTypes::Cancel_Construction)
	{
		BWAPI::Unit extractor = nullptr;
		for (auto & unit : BWAPI::Broodwar->self()->getUnits())
		{
			if (unit->getType() == BWAPI::UnitTypes::Zerg_Extractor)
			{
				extractor = unit;
			}
		}

		if (extractor)
		{
			extractor->cancelConstruction();
		}
	}
}
Example #15
0
// on unit destroy
void ProductionManager::onUnitDestroy(BWAPI::Unit unit)
{
	// we don't care if it's not our unit
	if (!unit || unit->getPlayer() != BWAPI::Broodwar->self())
	{
		return;
	}
		
	if (Config::Modules::UsingBuildOrderSearch)
	{
		// if it's a worker or a building, we need to re-search for the current goal
		if ((unit->getType().isWorker() && !WorkerManager::Instance().isWorkerScout(unit)) || unit->getType().isBuilding())
		{
			if (unit->getType() != BWAPI::UnitTypes::Zerg_Drone)
			{
				performBuildOrderSearch();
			}
		}
	}
}
Example #16
0
bool CheeseStrategies::StandardPlay::startTech(BWAPI::TechType tech) {
   UnitType techBuildingType = tech.whatResearches();

    if (Broodwar->self()->completedUnitCount(techBuildingType) == 0) {
        return false;
    }

    UnitSet myUnits = BWAPI::Broodwar->self()->getUnits();
    UnitSet::iterator it;

    BWAPI::Unit* techBuilding;

    for (it=myUnits.begin(); it!=myUnits.end(); it++) {
        if ((*it)->getType() == techBuildingType) {
            techBuilding = (*it);
        }
    }

    return techBuilding->research(tech);
}
Example #17
0
int UnitUtil::GetAttackRange(BWAPI::Unit attacker, BWAPI::Unit target)
{
    BWAPI::WeaponType weapon = GetWeapon(attacker, target);

    if (weapon == BWAPI::WeaponTypes::None)
    {
        return 0;
    }

    int range = weapon.maxRange();

    if ((attacker->getType() == BWAPI::UnitTypes::Protoss_Dragoon) 
        && (attacker->getPlayer() == BWAPI::Broodwar->self())
        && BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Singularity_Charge))
	{
		range = 6 * 32;
	}

    return range;
}
Example #18
0
bool UnitUtil::IsValidUnit(BWAPI::Unit unit)
{
    if (!unit)
    {
        return false;
    }

    if (unit->isCompleted() 
        && unit->getHitPoints() > 0 
        && unit->exists() 
        && unit->getType() != BWAPI::UnitTypes::Unknown 
        && unit->getPosition().x != BWAPI::Positions::Unknown.x 
        && unit->getPosition().y != BWAPI::Positions::Unknown.y) 
    {
        return true;
    }
    else
    {
        return false;
    }
}
Example #19
0
int WorkerData::getNumAssignedWorkers(BWAPI::Unit unit)
{
	if (!unit) { return 0; }

	std::map<BWAPI::Unit, int>::iterator it;
	
	// if the worker is mining, set the iterator to the mineral map
	if (unit->getType().isResourceDepot())
	{
		it = depotWorkerCount.find(unit);

		// if there is an entry, return it
		if (it != depotWorkerCount.end())
		{
			return it->second;
		}
	}
	else if (unit->getType().isRefinery())
	{
		it = refineryWorkerCount.find(unit);

		// if there is an entry, return it
		if (it != refineryWorkerCount.end())
		{
			return it->second;
		}
		// otherwise, we are only calling this on completed refineries, so set it
		else
		{
			refineryWorkerCount[unit] = 0;
		}
	}

	// when all else fails, return 0
	return 0;
}
Example #20
0
void LizurdModule::onUnitDestroy(BWAPI::Unit unit)
{
	if(_initialised == Result::Success)
	{
		if (!Broodwar->isReplay())
		{
			if(unit->getPlayer() == Broodwar->self())
			{
				Notification notification(UnitDiscoveryCoord);
				notification.SetAction(Action::DeRegisterUnit);
				notification.AddUnit(unit);
				_gateway.RegisterNotification(notification);
			}
		}
	}
}
Example #21
0
void OpprimoBot::onUnitMorph(BWAPI::Unit unit)
{
    if (Broodwar->isReplay() || Broodwar->getFrameCount() <= 1) return;

    if (unit->getPlayer()->getID() == Broodwar->self()->getID())
    {
        if (Constructor::isZerg())
        {
            loop.morphUnit(unit);
        }
        else
        {
            loop.addUnit(unit);
        }
    }
}
Example #22
0
Rect UnitUtil::GetRect(BWAPI::Unit unit)
{
    Rect r;

    r.x = unit->getLeft();
    r.y = unit->getTop();
    r.height = unit->getBottom() - unit->getTop();
    r.width = unit->getLeft() - unit->getRight();

    return r;
}
Example #23
0
void TurkAnalyzer::onUnitComplete(BWAPI::Unit unit)
{
	if (unit->getType().isBuilding() && !unit->getPlayer()->isNeutral())
	{
		Position pos = unit->getPosition();
		//int seconds = Broodwar->getFrameCount() / 24;
		//int minutes = seconds / 60;
		//seconds %= 60;
		Broodwar->sendText("%.2d:%.2d: %s completed a %s", pos, unit->getPlayer()->getName().c_str(), unit->getType().c_str());

		if (unit->getType() == BWAPI::UnitTypes::Protoss_Gateway)
		{
			FirstGateExist = true;
		}
		else if (unit->getType() == BWAPI::UnitTypes::Protoss_Pylon)
		{
			FirstPylonExist = true;
		}
		else if (unit->getType() == BWAPI::UnitTypes::Protoss_Assimilator)
		{
			FirstGasExist = true;
		}
		else if (unit->getType() == BWAPI::UnitTypes::Protoss_Cybernetics_Core)
		{
			FirstCybernetics = true;
			PylonLimiter = 1;
		}
		else if (unit->getType() == BWAPI::UpgradeTypes::Singularity_Charge)
		{
			Singularity = true;
		}
		else if (unit->getType() == BWAPI::UnitTypes::Protoss_Citadel_of_Adun)
		{
			FirstAdun = true;
		}
		else if (unit->getType() == BWAPI::UpgradeTypes::Leg_Enhancements)
		{
			Leg_Enhancements = true;
		}

	}
}
Example #24
0
bool UnitUtil::CanAttackGround(BWAPI::Unit unit)
{
    return unit->getType().groundWeapon() != BWAPI::WeaponTypes::None;
}
Example #25
0
bool UnitUtil::CanAttackAir(BWAPI::Unit unit)
{
    return unit->getType().airWeapon() != BWAPI::WeaponTypes::None;
}
Example #26
0
BWAPI::WeaponType UnitUtil::GetWeapon(BWAPI::Unit attacker, BWAPI::Unit target)
{
    return target->isFlying() ? attacker->getType().airWeapon() : attacker->getType().groundWeapon();
}
Example #27
0
void CombatManager::update()
{
	// Get new agents into state
	addNewAgents();  

	// TODO : Merge squads

	// Attack?
	const int numTroops = numLivingAgents();
	//const int threshold = 15;


	// Update squad leaders
	for (SquadVectorIter it = attackSquads.begin(); it != attackSquads.end(); it++)
	{
		Agent *leader = (*it)->getLeader();
		BWAPI::Unit * leaderUnit = &(leader->getUnit());

		// Attack with full squad force (adjust to lower)
		// Otherwise while we are filling up, look mean
		if ((*it)->getSize() == AttackSquadSize && leader != NULL && numTroops > 50)
		{
			leader->setState(AttackState);
			leader->setPositionTarget(enemyBase);
		}
		else if (leader != NULL){
			leader->setState(AttackState);
			// keep position target at base chokepoint
		}

		// check for enemy unit targets in range of leader
		// TODO: set this up for closest weakest enemy

		//BWAPI::WeaponType wt = leader->getUnitWeaponType();
		// TODO: add more weapon types
		//set<BWAPI::Unit *> unitsInRange = leaderUnit->getUnitsInWeaponRange(wt);

		// hopefully this covers the back of the squad better (furthest from leader)
		int killZoneRadius = leaderUnit->getType().seekRange() + (*it)->getRadius();
		set<BWAPI::Unit *> unitsInRange = leaderUnit->getUnitsInRadius(killZoneRadius);

		if ((int)unitsInRange.size() > 0)
		{
			int hitPoints = 99999;
			BWAPI::Unit * enemyTargetInRange = NULL;

			// get weakest enemy or a medic target
			for (UnitSetIter unitIt = unitsInRange.begin(); unitIt != unitsInRange.end(); unitIt++)
			{
				// check for enemy
				if ((*unitIt)->getPlayer() != Broodwar->self() 
					&& ((*unitIt)->getType().canAttack() 
					|| (*unitIt)->getType() == BWAPI::UnitTypes::Terran_Medic
					|| (*unitIt)->getType() == BWAPI::UnitTypes::Terran_Bunker))
				{
					// also check shields
					int tempHitPoints = (*unitIt)->getHitPoints() + (*unitIt)->getShields();

					if (tempHitPoints == 0)
						continue;

					if ((*unitIt)->getType() == BWAPI::UnitTypes::Terran_Medic)
					{
						enemyTargetInRange = *unitIt;
						break;
					}
					else if (tempHitPoints < hitPoints)
					{
						hitPoints = tempHitPoints;
						enemyTargetInRange = *unitIt;
					}
				}
			}
			// find a target?
			if (enemyTargetInRange != NULL)
			{
				leader->setState(AttackState);
				leader->setUnitTarget(enemyTargetInRange);
			}
			else 
			{
				// reset if no targets in range
				leader->setUnitTarget(NULL);
			}
		}
	} // end squad leader update


	// Move marines from defense squad to bunker squad if one available
	if ((int)bunkerAgents.size() > 0 
		&& (int)bunkerSquads.size() > 0 
		&& (int)defendSquads.size() > 0)
	{
		while ( bunkerSquads.back()->getSize() < 4 
			&& defendSquads.back()->getSize() > 0)
		{
			defendSquads.back()->moveAgent(*(defendSquads.back()->getAgents().begin()), bunkerSquads.back());
		}
	}

	/* Update attack, defend, and bunker squads */
	for (SquadVectorIter it = attackSquads.begin(); it != attackSquads.end(); it++)
	{
		(*it)->update();
	}
	for (SquadVectorIter it = defendSquads.begin(); it != defendSquads.end(); it++)
	{
		(*it)->update();
	}
	for (SquadVectorIter it = bunkerSquads.begin(); it != bunkerSquads.end(); it++)
	{
		(*it)->update();
	}

	// Clean up squads where everyone is dead 
	vector<SquadVectorIter> itersToErase;
	for(SquadVectorIter it = attackSquads.begin(); it != attackSquads.end(); ++it)
	{
		Squad *squad = *it;
		if( squad->numAlive() == 0 )
		{
			delete squad;
			itersToErase.push_back(it);
		}
	}
	for(vector<SquadVectorIter>::iterator it = itersToErase.begin();
		it != itersToErase.end(); ++it)
	{
		attackSquads.erase(*it);
	}
	itersToErase.clear();
	for(SquadVectorIter it = defendSquads.begin(); it != defendSquads.end(); ++it)
	{
		Squad *squad = *it;
		if( squad->numAlive() == 0 )
		{
			delete squad;
			itersToErase.push_back(it);
		}
	}
	for(vector<SquadVectorIter>::iterator it = itersToErase.begin();
		it != itersToErase.end(); ++it)
	{
		defendSquads.erase(*it);
	}
	itersToErase.clear();
	for(SquadVectorIter it = bunkerSquads.begin(); it != bunkerSquads.end(); ++it)
	{
		Squad *squad = *it;
		if( squad->numAlive() == 0 )
		{
			delete squad;
			itersToErase.push_back(it);
		}
	}
	for(vector<SquadVectorIter>::iterator it = itersToErase.begin();
		it != itersToErase.end(); ++it)
	{
		bunkerSquads.erase(*it);
	}
	itersToErase.clear();


	/* Base class updates Agents */
	Manager::update();
}