Steamhammer/Source/StrategyManager.cpp
const bool StrategyManager::shouldExpandNow() const
{
	// if there is no place to expand to, we can't expand
	// We check mineral expansions only.
	if (MapTools::Instance().getNextExpansion(false, true, false) == BWAPI::TilePositions::None)
	{
		return false;
	}

	size_t numDepots = UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Terran_Command_Center)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Protoss_Nexus)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Hatchery)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Lair)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Hive);

	numDepots += BuildingManager::Instance().getNumUnstarted(BWAPI::Broodwar->self()->getRace().getResourceDepot());

	// if we have idle workers then we need a new expansion
	if (WorkerManager::Instance().getNumIdleWorkers() > 10
		|| (numDepots * 18) < UnitUtil::GetAllUnitCount(BWAPI::Broodwar->self()->getRace().getWorker()))
	{
		return true;
	}

	return false;
}
// This is used for terran and protoss.
This is used for terran and protoss.
This is used for terran and protoss .
const bool StrategyManager::shouldExpandNow() const
{
	if (MapTools::Instance().getNextExpansion(false, true, false) == BWAPI::TilePositions::None)
	{
		return false;
	}
	size_t numDepots = UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Terran_Command_Center)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Protoss_Nexus)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Hatchery)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Lair)
		+ UnitUtil::GetAllUnitCount(BWAPI::UnitTypes::Zerg_Hive);
	numDepots += BuildingManager::Instance().getNumUnstarted(BWAPI::Broodwar->self()->getRace().getResourceDepot());
	if (WorkerManager::Instance().getNumIdleWorkers() > 10
		|| (numDepots * 18) < UnitUtil::GetAllUnitCount(BWAPI::Broodwar->self()->getRace().getWorker()))
	{
		return true;
	}
	return false;
}
const bool StrategyManager :: shouldExpandNow ( ) const { if ( MapTools :: Instance ( ) . getNextExpansion ( false , true , false ) == BWAPI :: TilePositions :: None ) { return false ; } size_t numDepots = UnitUtil :: GetAllUnitCount ( BWAPI :: UnitTypes :: Terran_Command_Center ) + UnitUtil :: GetAllUnitCount ( BWAPI :: UnitTypes :: Protoss_Nexus ) + UnitUtil :: GetAllUnitCount ( BWAPI :: UnitTypes :: Zerg_Hatchery ) + UnitUtil :: GetAllUnitCount ( BWAPI :: UnitTypes :: Zerg_Lair ) + UnitUtil :: GetAllUnitCount ( BWAPI :: UnitTypes :: Zerg_Hive ) ; numDepots += BuildingManager :: Instance ( ) . getNumUnstarted ( BWAPI :: Broodwar -> self ( ) -> getRace ( ) . getResourceDepot ( ) ) ; if ( WorkerManager :: Instance ( ) . getNumIdleWorkers ( ) > 10 || ( numDepots * 18 ) < UnitUtil :: GetAllUnitCount ( BWAPI :: Broodwar -> self ( ) -> getRace ( ) . getWorker ( ) ) ) { return true ; } return false ; }
This is used for terran and protoss.
This is used for terran and protoss .
// if there is no place to expand to, we can't expand // We check mineral expansions only. // if we have idle workers then we need a new expansion