BWAPI
Classes | Functions
Skynet/Skynet/BuildingPlacer.cpp File Reference
#include "BuildingPlacer.h"
#include <boost/bind.hpp>
#include "BaseTracker.h"
#include "UnitHelper.h"
#include "MapHelper.h"
#include "UnitTracker.h"
#include "TerrainAnaysis.h"
#include "DrawBuffer.h"
#include "WallTracker.h"
#include "BorderTracker.h"
#include "ScoutManager.h"
#include "PylonPowerTracker.h"
Include dependency graph for BuildingPlacer.cpp:

Go to the source code of this file.

Classes

class  BuildLocationCompare
class  RegionChokeCompare

Functions

bool baseCompare (const Base &i, const Base &j)
bool baseComparePylon (const Base &i, const Base &j)
bool baseCompareDefense (const Base &i, const Base &j, BWAPI::UnitType type)

Function Documentation

bool baseCompare ( const Base i,
const Base j 
)

Definition at line 588 of file BuildingPlacer.cpp.

References BWAPI::Broodwar.

Referenced by baseComparePylon(), and BuildingPlacerClass::baseToBuildAtOrder().

{
        if(BWAPI::Broodwar->getFrameCount() < 12000)
        {
                if(i->isStartLocation())
                {
                        if(!j->isStartLocation())
                                return true;
                }
                else if(j->isStartLocation())
                        return false;
        }

        return (i->getNumberOfTechBuildings() > j->getNumberOfTechBuildings());
}

Here is the caller graph for this function:

bool baseCompareDefense ( const Base i,
const Base j,
BWAPI::UnitType  type 
)

Definition at line 642 of file BuildingPlacer.cpp.

References BWAPI::Broodwar, and BWAPI::Game::self().

Referenced by BuildingPlacerClass::baseToBuildAtOrder().

{
        int iCount = 0;
        for each(Unit building in i->getBuildings())
        {
                if(building->getType() == type && building->getPlayer() == BWAPI::Broodwar->self())
                        ++iCount;
        }

        int jCount = 0;
        for each(Unit building in j->getBuildings())
        {
                if(building->getType() == type && building->getPlayer() == BWAPI::Broodwar->self())
                        ++jCount;
        }

        return jCount > iCount;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool baseComparePylon ( const Base i,
const Base j 
)

Definition at line 604 of file BuildingPlacer.cpp.

References baseCompare(), BWAPI::Broodwar, BWAPI::UnitTypes::Protoss_Pylon, and BWAPI::Game::self().

Referenced by BuildingPlacerClass::baseToBuildAtOrder().

{
        // Prioritise a base without a depot the lowest
        if(i->getResourceDepot())
        {
                if(!j->getResourceDepot())
                        return true;
        }
        else if(!j->getResourceDepot())
                return false;

        // Next prioritise the base that doesn't have a pylon
        int iCount = 0;
        for each(Unit building in i->getBuildings())
        {
                if(building->getType() == BWAPI::UnitTypes::Protoss_Pylon && building->getPlayer() == BWAPI::Broodwar->self())
                        ++iCount;
        }

        int jCount = 0;
        for each(Unit building in j->getBuildings())
        {
                if(building->getType() == BWAPI::UnitTypes::Protoss_Pylon && building->getPlayer() == BWAPI::Broodwar->self())
                        ++jCount;
        }

        if(iCount == 0)
        {
                if(jCount != 0)
                        return true;
        }
        else if(jCount == 0)
                return false;

        // Finally prioritise using the default sort
        return baseCompare(i, j);
}

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines