\hypertarget{classBuildingPlacerClass}{\section{\-Building\-Placer\-Class \-Class \-Reference}
\label{classBuildingPlacerClass}\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}}
}


{\ttfamily \#include $<$\-Building\-Placer.\-h$>$}

\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classBuildingPlacerClass_a98d6ee1248bb60a7d085585c0ca8c991}{\-Building\-Placer\-Class} ()
\item 
void \hyperlink{classBuildingPlacerClass_a844a743f1b9992483da28ce34821898d}{reserve\-Resource\-Space} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&resources, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} base)
\item 
void \hyperlink{classBuildingPlacerClass_ad3f06d09bcca2c89db3cd650d594b9f4}{calculate\-Reservations} ()
\item 
void \hyperlink{classBuildingPlacerClass_a9445ac7610774a74dd9eddff232e4996}{finalise\-Reservations} ()
\item 
void \hyperlink{classBuildingPlacerClass_a925031ca8831544c8787d658779e0bf8}{update} ()
\item 
void \hyperlink{classBuildingPlacerClass_a595c37835428cb2c56a67595c0cb5ebd}{on\-Destroy} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
\hyperlink{ReservedLocation_8h_a394afa79b90ceb71a935a5aee73530bf}{\-Reserved\-Location} \hyperlink{classBuildingPlacerClass_a3b8a05802eb94d9abfdbd1f90bf51abc}{get\-Landing\-Reservation} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
\hyperlink{ReservedLocation_8h_a394afa79b90ceb71a935a5aee73530bf}{\-Reserved\-Location} \hyperlink{classBuildingPlacerClass_a9c37a7a75cb9a8c42026a989a43cce32}{get\-Building\-Reservation} (\hyperlink{ReservedLocation_8h_a6492493e05598f5483be9ef982314a50}{\-Building\-Location} position, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type)
\item 
bool \hyperlink{classBuildingPlacerClass_a5ff79bc3f2ad9825653a45a191b389bb}{is\-Reserved} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} position) const 
\item 
bool \hyperlink{classBuildingPlacerClass_a1b7b0f9f503b5ceebfe0a0a02365d3a0}{is\-Reserved} (int x, int y) const 
\item 
bool \hyperlink{classBuildingPlacerClass_af27a8a1e2bf3e793d565e74fa4b609b0}{is\-Resource\-Reserved} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} position) const 
\item 
bool \hyperlink{classBuildingPlacerClass_af4964eae7fdac27b9e505507ae123909}{is\-Resource\-Reserved} (int x, int y) const 
\item 
std\-::vector$<$ \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBuildingPlacerClass_af99ef3276907be1920d052d9ce369f5f}{base\-To\-Build\-At\-Order} (\hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type) const 
\item 
std\-::vector$<$ \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBuildingPlacerClass_a0258a51b2ca40cac66af3447a3edfb80}{base\-To\-Build\-At\-Order} () const 
\item 
std\-::pair$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBuildingPlacerClass_a52e9bb8d2273a2b66235e64fdea310ad}{building\-Location\-To\-Tile} (\hyperlink{ReservedLocation_8h_a6492493e05598f5483be9ef982314a50}{\-Building\-Location} position, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type) const 
\item 
std\-::pair$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBuildingPlacerClass_a903a5261eaed7caa5a617c49e1a8a46b}{get\-Expand\-Location} (bool gas=false) const 
\item 
std\-::pair$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBuildingPlacerClass_a8c05d1f643bb6b3570c7c28c0a81c53c}{get\-Refinery\-Location} () const 
\item 
std\-::pair$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBuildingPlacerClass_a3c70462312762e88da75a810dc917719}{getlanding\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} \hyperlink{classBuildingPlacerClass_af9128b826e328d903483d5e3f2771d4e}{get\-Build\-Location} (\hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} base, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type) const 
\item 
bool \hyperlink{classBuildingPlacerClass_af9969b53415412ac0779a2dc0e0cd2b1}{is\-Location\-Non\-Blocking} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} position, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type, bool ignore\-Reservations=false) const 
\item 
bool \hyperlink{classBuildingPlacerClass_ad2df8506697f9836ecdb05f2271dafb1}{is\-Location\-Buildable} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} position, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type, bool ignore\-Reservations=false) const 
\item 
bool \hyperlink{classBuildingPlacerClass_a19c980cdc42f9c30683373001d067b62}{is\-Tile\-Blocked} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} tile, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type, bool ignore\-Reservations=false) const 
\item 
bool \hyperlink{classBuildingPlacerClass_a724f8d7d767e727e96ece195ccca62c6}{is\-Tile\-Buildable} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} tile, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type, bool ignore\-Reservations=false) const 
\item 
bool \hyperlink{classBuildingPlacerClass_a0b67c3238e347f4a141db5d268851c20}{is\-Tile\-Walkable} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} tile, bool ignore\-Reservations=false) const 
\item 
bool \hyperlink{classBuildingPlacerClass_a0866b75c2dffd24ca1c396ad1e9556c7}{is\-Addon\-Buildable} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} position) const 
\item 
std\-::set$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$ \hyperlink{classBuildingPlacerClass_aeecd24aceddc4ab4afa92932347a9fe5}{get\-Surrounding\-Tiles} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} position, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type, bool ignore\-Reservations=false) const 
\item 
bool \hyperlink{classBuildingPlacerClass_a7abfd5d8bcc71fcdd072e9bde1e4af57}{is\-Addon\-Builder} (int x, int y) const 
\item 
void \hyperlink{classBuildingPlacerClass_a202e9d94cf4546cd07df7b70703ecf08}{reserve} (\hyperlink{ReservedLocation_8h_a394afa79b90ceb71a935a5aee73530bf}{\-Reserved\-Location} location)
\item 
void \hyperlink{classBuildingPlacerClass_aab7774fd8563d12b7cab97c18545bbaf}{free} (\hyperlink{ReservedLocation_8h_a394afa79b90ceb71a935a5aee73530bf}{\-Reserved\-Location} location)
\end{DoxyCompactItemize}
\subsection*{\-Private \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classBuildingPlacerClass_afbaa3d482a439e5e3f7a67a7d7c2b568}{remember\-Best\-Expand\-Location} (\hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} base, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} \&best\-Base, int \&closest\-Distance, int \&furthest\-Distance, \hyperlink{BuildingPlacer_8h_a0cc7af928edc922e9fbe84c693c34321}{\-Expand\-Type} \&type, bool gas, std\-::set$<$ \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ enemy\-Bases) const 
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, \*
\hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} $>$ \hyperlink{classBuildingPlacerClass_ac057090be47ef08890225f6e313d2bc9}{m\-Permanent\-Reserved}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, int $>$ \hyperlink{classBuildingPlacerClass_a262ba1988a001c81810648bfbf609c84}{m\-Resource\-Reserved}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit}, std\-::set\*
$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$ $>$ \hyperlink{classBuildingPlacerClass_a50b9843c5143a22141d7f7c386fb1ba0}{m\-Resources}
\item 
std\-::set$<$ \hyperlink{ReservedLocation_8h_a394afa79b90ceb71a935a5aee73530bf}{\-Reserved\-Location} $>$ \hyperlink{classBuildingPlacerClass_acab0dc50f00cd3bae8d9c32eb57cf4bc}{m\-Reserved\-Locations}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position}, \*
\hyperlink{ReservedLocation_8h_a394afa79b90ceb71a935a5aee73530bf}{\-Reserved\-Location} $>$ \hyperlink{classBuildingPlacerClass_af849a1f4e81b8e25b1feb620233e0bd3}{m\-Reserved\-Tiles}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 21 of file \-Building\-Placer.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classBuildingPlacerClass_a98d6ee1248bb60a7d085585c0ca8c991}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!\-Building\-Placer\-Class@{\-Building\-Placer\-Class}}
\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{\-Building\-Placer\-Class}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Building\-Placer\-Class\-::\-Building\-Placer\-Class} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a98d6ee1248bb60a7d085585c0ca8c991}


\-Definition at line 16 of file \-Building\-Placer.\-cpp.


\begin{DoxyCode}
{
}
\end{DoxyCode}


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classBuildingPlacerClass_af99ef3276907be1920d052d9ce369f5f}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!base\-To\-Build\-At\-Order@{base\-To\-Build\-At\-Order}}
\index{base\-To\-Build\-At\-Order@{base\-To\-Build\-At\-Order}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{base\-To\-Build\-At\-Order}]{\setlength{\rightskip}{0pt plus 5cm}std\-::vector$<$ {\bf \-Base} $>$ {\bf \-Building\-Placer\-Class\-::base\-To\-Build\-At\-Order} (
\begin{DoxyParamCaption}
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_af99ef3276907be1920d052d9ce369f5f}


\-Definition at line 661 of file \-Building\-Placer.\-cpp.



\-References base\-Compare\-Defense(), base\-Compare\-Pylon(), base\-To\-Build\-At\-Order(), \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Photon\-\_\-\-Cannon, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Pylon, \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::requires\-Psi(), \-B\-W\-A\-P\-I\-::\-Game\-::self(), and \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Terran\-\_\-\-Missile\-\_\-\-Turret.


\begin{DoxyCode}
{
        std::vector<Base> basesOrder = baseToBuildAtOrder();

        if(type == BWAPI::UnitTypes::Protoss_Pylon)
        {
                std::sort(basesOrder.begin(), basesOrder.end(), baseComparePylon
      );
        }
        else if(type == BWAPI::UnitTypes::Protoss_Photon_Cannon || type == 
      BWAPI::UnitTypes::Terran_Missile_Turret)
        {
                std::vector<Base> newBasesOrder;
                for each(Base base in basesOrder)
                {
                        if(base->getMinerals().empty())
                                continue;

                        bool hasPylon = type.requiresPsi() ? false : true;

                        if(!hasPylon)
                        {
                                std::set<Unit> buildings = base->getBuildings()
      ;
                                for each(Unit building in buildings)
                                {
                                        if(building->getType() == 
      BWAPI::UnitTypes::Protoss_Pylon && building->getPlayer() == BWAPI::Broodwar->
      self() && building->isCompleted())
                                                hasPylon = true;
                                }
                        }

                        if(hasPylon)
                                newBasesOrder.push_back(base);
                }

                std::sort(newBasesOrder.begin(), newBasesOrder.end(), 
      boost::bind<bool>(&baseCompareDefense, _1, _2, type));

                return newBasesOrder;
        }

        return basesOrder;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_af99ef3276907be1920d052d9ce369f5f_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a0258a51b2ca40cac66af3447a3edfb80}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!base\-To\-Build\-At\-Order@{base\-To\-Build\-At\-Order}}
\index{base\-To\-Build\-At\-Order@{base\-To\-Build\-At\-Order}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{base\-To\-Build\-At\-Order}]{\setlength{\rightskip}{0pt plus 5cm}std\-::vector$<$ {\bf \-Base} $>$ {\bf \-Building\-Placer\-Class\-::base\-To\-Build\-At\-Order} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a0258a51b2ca40cac66af3447a3edfb80}


\-Definition at line 701 of file \-Building\-Placer.\-cpp.



\-References base\-Compare(), and \-Singleton$<$ T $>$\-::\-Instance().



\-Referenced by base\-To\-Build\-At\-Order(), building\-Location\-To\-Tile(), and get\-Refinery\-Location().


\begin{DoxyCode}
{
        std::vector<Base> returnValue;

        for each(Base base in BaseTracker::Instance().getPlayerBases())
        {
                if(!base->isUnderAttack())
                        returnValue.push_back(base);
        }

        std::sort(returnValue.begin(), returnValue.end(), baseCompare);

        return returnValue;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a0258a51b2ca40cac66af3447a3edfb80_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a0258a51b2ca40cac66af3447a3edfb80_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a52e9bb8d2273a2b66235e64fdea310ad}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!building\-Location\-To\-Tile@{building\-Location\-To\-Tile}}
\index{building\-Location\-To\-Tile@{building\-Location\-To\-Tile}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{building\-Location\-To\-Tile}]{\setlength{\rightskip}{0pt plus 5cm}std\-::pair$<$ {\bf \-Tile\-Position}, {\bf \-Base} $>$ {\bf \-Building\-Placer\-Class\-::building\-Location\-To\-Tile} (
\begin{DoxyParamCaption}
\item[{{\bf \-Building\-Location}}]{position, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a52e9bb8d2273a2b66235e64fdea310ad}


\-Definition at line 205 of file \-Building\-Placer.\-cpp.



\-References \-Building\-Location\-Def\-::\-Base, \-Building\-Location\-Def\-::\-Base\-Choke, \-Building\-Location\-Def\-::\-Base\-Parimeter, base\-To\-Build\-At\-Order(), \-Building\-Location\-Def\-::\-Expansion, \-Building\-Location\-Def\-::\-Expansion\-Gas, get\-Build\-Location(), get\-Expand\-Location(), get\-Refinery\-Location(), \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Refinery(), \-Building\-Location\-Def\-::\-Manner, \-B\-W\-A\-P\-I\-::\-Tile\-Positions\-::\-None, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Pylon, \-Building\-Location\-Def\-::\-Proxy, \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::requires\-Psi(), and \-Safe\-Enum$<$ def, inner $>$\-::underlying().


\begin{DoxyCode}
{
        if(type.isRefinery())
                return getRefineryLocation();

        if(type.requiresPsi())
        {
                bool atleastone = false;
                for each(Unit pylon in UnitTracker::Instance().selectAllUnits(
      BWAPI::UnitTypes::Protoss_Pylon))
                {
                        if(pylon->isCompleted())
                                atleastone = true;
                }
                if(!atleastone)
                        return std::make_pair(BWAPI::TilePositions::None, Base(
      ));
        }

        switch(position.underlying())
        {
        case BuildingLocation::BaseChoke:
                {
                        TilePosition pos = WallTracker::Instance().
      getWallPosition(type);
                        if(pos != BWAPI::TilePositions::None)
                                return std::make_pair(pos, BaseTracker::Instance
      ().getBase(pos));
                }
        case BuildingLocation::BaseParimeter:
        case BuildingLocation::Base:
                {
                        for each(Base base in baseToBuildAtOrder(type))
                        {
                                TilePosition pos = getBuildLocation(base, type)
      ; // TODO : flags of some sort so certain units can be build in minerals etc

                                if(pos != BWAPI::TilePositions::None)
                                        return std::make_pair(pos, base);
                        }
                        break;
                }
        case BuildingLocation::Expansion:
                        return getExpandLocation();
        case BuildingLocation::ExpansionGas:
                        return getExpandLocation(true);
        case BuildingLocation::Proxy:
                        //TODO: find a location that isn't on the path between
       any base to any other base start locations closest to potential enemy locations
        case BuildingLocation::Manner:
                        //TODO: build in a location that harms the enemy,
       engineering bay in expand location, pylon in mineral line, gas steal etc
                break;
        }

        return std::make_pair(BWAPI::TilePositions::None, Base());
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a52e9bb8d2273a2b66235e64fdea310ad_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_ad3f06d09bcca2c89db3cd650d594b9f4}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!calculate\-Reservations@{calculate\-Reservations}}
\index{calculate\-Reservations@{calculate\-Reservations}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{calculate\-Reservations}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::calculate\-Reservations} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_ad3f06d09bcca2c89db3cd650d594b9f4}


\-Definition at line 20 of file \-Building\-Placer.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Race\-::get\-Center(), \-B\-W\-A\-P\-I\-::\-Player\-::get\-Race(), \-B\-W\-A\-P\-I\-::\-Race\-::get\-Refinery(), \-Singleton$<$ T $>$\-::\-Instance(), m\-Permanent\-Reserved, reserve\-Resource\-Space(), \-B\-W\-A\-P\-I\-::\-Game\-::self(), and \-B\-W\-A\-P\-I\-::\-Races\-::\-Zerg.


\begin{DoxyCode}
{
        const BWAPI::UnitType &centerType = BWAPI::Broodwar->self()->getRace().
      getCenter();
        const BWAPI::UnitType &refineryType = BWAPI::Broodwar->self()->getRace(
      ).getRefinery();

        // first reserve all wall positions
        mPermanentReserved = WallTracker::Instance().getWallTiles();

        // for each base that has resources
        for each(Base base in BaseTracker::Instance().getResourceBases())
        {
                // reserve the base location
                for(int x = base->getCenterBuildLocation().x(); x < base->
      getCenterBuildLocation().x()+centerType.tileWidth(); ++x)
                        for(int y = base->getCenterBuildLocation().y(); y < 
      base->getCenterBuildLocation().y()+centerType.tileHeight(); ++y)
                                mPermanentReserved[TilePosition(x, y)] = 
      centerType;

                // if its zerg, also reserve the area the larva hang out
                if(BWAPI::Broodwar->self()->getRace() == BWAPI::Races::Zerg)
                {
                        for(int x = base->getCenterBuildLocation().x() - 1; x <
       base->getCenterBuildLocation().x()+centerType.tileWidth()+1; ++x)
                                for(int y = base->getCenterBuildLocation().y() 
      - 1; y < base->getCenterBuildLocation().y()+centerType.tileHeight()+1; ++y)
                                        mPermanentReserved[TilePosition(x, y)] 
      = centerType;
                }

                // and reserve the geyser space just so it doesn't get included
       in the resource reserved space
                for each(Unit geyser in base->getGeysers())
                {
                        for(int x = geyser->getTilePosition().x(); x < geyser->
      getTilePosition().x()+geyser->getType().tileWidth(); ++x)
                                for(int y = geyser->getTilePosition().y(); y < 
      geyser->getTilePosition().y()+geyser->getType().tileHeight(); ++y)
                                        mPermanentReserved[TilePosition(x, y)] 
      = refineryType;
                }

                reserveResourceSpace(base->getMinerals(), base);
                reserveResourceSpace(base->getGeysers(), base);
        }
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_ad3f06d09bcca2c89db3cd650d594b9f4_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a9445ac7610774a74dd9eddff232e4996}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!finalise\-Reservations@{finalise\-Reservations}}
\index{finalise\-Reservations@{finalise\-Reservations}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{finalise\-Reservations}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::finalise\-Reservations} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a9445ac7610774a74dd9eddff232e4996}


\-Definition at line 57 of file \-Building\-Placer.\-cpp.



\-References \-Singleton$<$ T $>$\-::\-Instance(), m\-Permanent\-Reserved, and \-B\-W\-A\-P\-I\-::\-Bullet\-Types\-::\-None.


\begin{DoxyCode}
{
        // Reserve the tiles around the choke for general use
        // TODO: perhaps only in a path between the two sides
        for each(Chokepoint choke in TerrainAnaysis::Instance().getChokepoints(
      ))
        {
                int minX = std::min(choke->getBuildTiles().first.x(), choke->
      getBuildTiles().second.x());
                int maxX = std::max(choke->getBuildTiles().first.x(), choke->
      getBuildTiles().second.x());

                int minY = std::min(choke->getBuildTiles().first.y(), choke->
      getBuildTiles().second.y());
                int maxY = std::max(choke->getBuildTiles().first.y(), choke->
      getBuildTiles().second.y());

                for(int x = minX; x <= maxX; ++x)
                        for(int y = minY; y <= maxY; ++y)
                                if(mPermanentReserved.count(TilePosition(x, y))
       == 0)
                                        mPermanentReserved[TilePosition(x, y)] 
      = BWAPI::UnitTypes::None;
        }
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a9445ac7610774a74dd9eddff232e4996_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_aab7774fd8563d12b7cab97c18545bbaf}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!free@{free}}
\index{free@{free}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{free}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::free} (
\begin{DoxyParamCaption}
\item[{{\bf \-Reserved\-Location}}]{location}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_aab7774fd8563d12b7cab97c18545bbaf}


\-Definition at line 155 of file \-Building\-Placer.\-cpp.



\-References \-Unit\-Helper\-::has\-Addon(), and m\-Reserved\-Tiles.


\begin{DoxyCode}
{
        int startx = location->getTilePosition().x();
        int starty = location->getTilePosition().y();

        int endx = startx + location->getUnitType().tileWidth();
        int endy = starty + location->getUnitType().tileHeight();

        if(UnitHelper::hasAddon(location->getUnitType()))
                endx += 2;

        for(int x = startx; x < endx; ++x)
                for(int y = starty; y < endy; ++y)
                        mReservedTiles.erase(TilePosition(x, y));
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_aab7774fd8563d12b7cab97c18545bbaf_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a9c37a7a75cb9a8c42026a989a43cce32}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!get\-Building\-Reservation@{get\-Building\-Reservation}}
\index{get\-Building\-Reservation@{get\-Building\-Reservation}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{get\-Building\-Reservation}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Reserved\-Location} {\bf \-Building\-Placer\-Class\-::get\-Building\-Reservation} (
\begin{DoxyParamCaption}
\item[{{\bf \-Building\-Location}}]{position, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a9c37a7a75cb9a8c42026a989a43cce32}


\-Definition at line 178 of file \-Building\-Placer.\-cpp.



\-References m\-Reserved\-Locations.


\begin{DoxyCode}
{
        ReservedLocation location(new ReservedLocationClass(type, position));
        mReservedLocations.insert(location);
        return location;
}
\end{DoxyCode}
\hypertarget{classBuildingPlacerClass_af9128b826e328d903483d5e3f2771d4e}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!get\-Build\-Location@{get\-Build\-Location}}
\index{get\-Build\-Location@{get\-Build\-Location}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{get\-Build\-Location}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Tile\-Position} {\bf \-Building\-Placer\-Class\-::get\-Build\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Base}}]{base, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_af9128b826e328d903483d5e3f2771d4e}


\-Definition at line 281 of file \-Building\-Placer.\-cpp.



\-References \-Map\-Helper\-::spiral\-Search().



\-Referenced by building\-Location\-To\-Tile().


\begin{DoxyCode}
{
        return MapHelper::spiralSearch(base->getCenterBuildLocation(), 
      BuildLocationCompare(base, type));
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_af9128b826e328d903483d5e3f2771d4e_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_af9128b826e328d903483d5e3f2771d4e_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a903a5261eaed7caa5a617c49e1a8a46b}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!get\-Expand\-Location@{get\-Expand\-Location}}
\index{get\-Expand\-Location@{get\-Expand\-Location}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{get\-Expand\-Location}]{\setlength{\rightskip}{0pt plus 5cm}std\-::pair$<$ {\bf \-Tile\-Position}, {\bf \-Base} $>$ {\bf \-Building\-Placer\-Class\-::get\-Expand\-Location} (
\begin{DoxyParamCaption}
\item[{bool}]{gas = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a903a5261eaed7caa5a617c49e1a8a46b}


\-Definition at line 743 of file \-Building\-Placer.\-cpp.



\-References \-Position\-Type\-Def\-::\-Bot\-Control\-Region, \-Position\-Type\-Def\-::\-Enemy\-Control\-Region, \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Tile\-Positions\-::\-None, and remember\-Best\-Expand\-Location().



\-Referenced by building\-Location\-To\-Tile().


\begin{DoxyCode}
{
        std::set<Base> enemyBases = BaseTracker::Instance().getEnemyBases();

        Base basePos;
        int closestDistance = std::numeric_limits<int>::max();
        int furthestDistance = std::numeric_limits<int>::min();
        ExpandType type = ExpandType::expNone;

        std::set<BorderPosition> myRegions = BorderTracker::Instance().
      getBorderPositions(PositionType::BotControlRegion);
        std::set<BorderPosition> enemyRegions = BorderTracker::Instance().
      getBorderPositions(PositionType::EnemyControlRegion);

        for(std::set<BorderPosition>::const_iterator it = myRegions.begin(); it
       != myRegions.end(); ++it)
        {
                for each(Base base in it->mRegion->getBases())
                {
                        rememberBestExpandLocation(base, basePos, 
      closestDistance, furthestDistance, type, gas, enemyBases);
                }
        }

        if(type == ExpandType::expNone)
        {
                for each(Base base in BaseTracker::Instance().getAllBases())
                {
                        if(enemyRegions.count(BorderPosition(
      PositionType::EnemyControlRegion, base->getRegion())) != 0)
                                continue;

                        rememberBestExpandLocation(base, basePos, 
      closestDistance, furthestDistance, type, gas, enemyBases);
                }
        }

        if(type == ExpandType::expNone)
        {
                for each(Base base in BaseTracker::Instance().getAllBases())
                {
                        rememberBestExpandLocation(base, basePos, 
      closestDistance, furthestDistance, type, gas, enemyBases);
                }
        }

        if(type != ExpandType::expNone)
                return std::make_pair(basePos->getCenterBuildLocation(), 
      basePos);
        else
                return std::make_pair(BWAPI::TilePositions::None, Base());
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a903a5261eaed7caa5a617c49e1a8a46b_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a903a5261eaed7caa5a617c49e1a8a46b_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a3c70462312762e88da75a810dc917719}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!getlanding\-Location@{getlanding\-Location}}
\index{getlanding\-Location@{getlanding\-Location}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{getlanding\-Location}]{\setlength{\rightskip}{0pt plus 5cm}std\-::pair$<$ {\bf \-Tile\-Position}, {\bf \-Base} $>$ {\bf \-Building\-Placer\-Class\-::getlanding\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a3c70462312762e88da75a810dc917719}


\-Definition at line 256 of file \-Building\-Placer.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Tile\-Positions\-::\-None.


\begin{DoxyCode}
{
        // TODO : NYI
        return std::make_pair(BWAPI::TilePositions::None, Base());
        //return
       BuildingPlacer::Instance().getBuildLocation(unit->getTilePosition() + TilePosition(0, 1));
}
\end{DoxyCode}
\hypertarget{classBuildingPlacerClass_a3b8a05802eb94d9abfdbd1f90bf51abc}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!get\-Landing\-Reservation@{get\-Landing\-Reservation}}
\index{get\-Landing\-Reservation@{get\-Landing\-Reservation}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{get\-Landing\-Reservation}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Reserved\-Location} {\bf \-Building\-Placer\-Class\-::get\-Landing\-Reservation} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a3b8a05802eb94d9abfdbd1f90bf51abc}


\-Definition at line 171 of file \-Building\-Placer.\-cpp.



\-References m\-Reserved\-Locations.


\begin{DoxyCode}
{
        ReservedLocation location(new ReservedLocationClass(unit));
        mReservedLocations.insert(location);
        return location;
}
\end{DoxyCode}
\hypertarget{classBuildingPlacerClass_a8c05d1f643bb6b3570c7c28c0a81c53c}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!get\-Refinery\-Location@{get\-Refinery\-Location}}
\index{get\-Refinery\-Location@{get\-Refinery\-Location}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{get\-Refinery\-Location}]{\setlength{\rightskip}{0pt plus 5cm}std\-::pair$<$ {\bf \-Tile\-Position}, {\bf \-Base} $>$ {\bf \-Building\-Placer\-Class\-::get\-Refinery\-Location} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a8c05d1f643bb6b3570c7c28c0a81c53c}


\-Definition at line 574 of file \-Building\-Placer.\-cpp.



\-References base\-To\-Build\-At\-Order(), is\-Reserved(), and \-B\-W\-A\-P\-I\-::\-Tile\-Positions\-::\-None.



\-Referenced by building\-Location\-To\-Tile().


\begin{DoxyCode}
{
        for each(Base base in baseToBuildAtOrder())
        {
                for each(Unit geyser in base->getGeysers())
                {
                        if(!isReserved(geyser->getTilePosition()))
                                return std::make_pair(geyser->getTilePosition()
      , base);
                }
        }

        return std::make_pair(BWAPI::TilePositions::None, Base());
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a8c05d1f643bb6b3570c7c28c0a81c53c_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a8c05d1f643bb6b3570c7c28c0a81c53c_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_aeecd24aceddc4ab4afa92932347a9fe5}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!get\-Surrounding\-Tiles@{get\-Surrounding\-Tiles}}
\index{get\-Surrounding\-Tiles@{get\-Surrounding\-Tiles}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{get\-Surrounding\-Tiles}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Tile\-Position} $>$ {\bf \-Building\-Placer\-Class\-::get\-Surrounding\-Tiles} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{position, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type, }
\item[{bool}]{ignore\-Reservations = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_aeecd24aceddc4ab4afa92932347a9fe5}


\-Definition at line 788 of file \-Building\-Placer.\-cpp.



\-References is\-Tile\-Walkable(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::tile\-Height(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::tile\-Width(), \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by is\-Location\-Non\-Blocking().


\begin{DoxyCode}
{
        std::set<TilePosition> tiles;
        int y1 = position.y() + type.tileHeight();
        int x1 = position.x() - 1;
        int y2 = position.y() + type.tileHeight() - 1;
        int x2 = position.x() - 1;

        while(true)
        {
                TilePosition t1(x1, y1);
                if(isTileWalkable(t1, ignoreReservations))
                        tiles.insert(t1);

                TilePosition t2(x2, y2);
                if(isTileWalkable(t2, ignoreReservations))
                        tiles.insert(t2);

                if(x1 < position.x() + type.tileWidth())
                        x1++;
                else
                        y1--;

                if(y1 == y2 && x1 == x2)
                        break;

                if(y2 > position.y() - 1)
                        y2--;
                else
                        x2++;
        }

        return tiles;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_aeecd24aceddc4ab4afa92932347a9fe5_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_aeecd24aceddc4ab4afa92932347a9fe5_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a0866b75c2dffd24ca1c396ad1e9556c7}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Addon\-Buildable@{is\-Addon\-Buildable}}
\index{is\-Addon\-Buildable@{is\-Addon\-Buildable}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Addon\-Buildable}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Addon\-Buildable} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{position}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a0866b75c2dffd24ca1c396ad1e9556c7}


\-Definition at line 733 of file \-Building\-Placer.\-cpp.



\-References is\-Tile\-Buildable(), \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Terran\-\_\-\-Machine\-\_\-\-Shop, \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by is\-Location\-Buildable().


\begin{DoxyCode}
{
        for(int x = position.x() + 4; x < position.x() + 6; ++x)
                for(int y = position.y() + 1; y < position.y() + 3; ++y)
                        if(!isTileBuildable(TilePosition(x, y), 
      BWAPI::UnitTypes::Terran_Machine_Shop))
                                return false;

        return true;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a0866b75c2dffd24ca1c396ad1e9556c7_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a0866b75c2dffd24ca1c396ad1e9556c7_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a7abfd5d8bcc71fcdd072e9bde1e4af57}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Addon\-Builder@{is\-Addon\-Builder}}
\index{is\-Addon\-Builder@{is\-Addon\-Builder}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Addon\-Builder}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Addon\-Builder} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a7abfd5d8bcc71fcdd072e9bde1e4af57}


\-Definition at line 715 of file \-Building\-Placer.\-cpp.



\-References \-Unit\-Helper\-::has\-Addon(), \-Singleton$<$ T $>$\-::\-Instance(), and m\-Permanent\-Reserved.



\-Referenced by is\-Tile\-Blocked().


\begin{DoxyCode}
{
        std::map<TilePosition, BWAPI::UnitType>::const_iterator it = 
      mPermanentReserved.find(TilePosition(x, y));
        if(it != mPermanentReserved.end())
        {
                if(UnitHelper::hasAddon(it->second))
                        return true;
        }

        for each(Unit unit in UnitTracker::Instance().getUnitsOnTile(x, y))
        {
                if(!unit->isLifted() && UnitHelper::hasAddon(unit->getType()))
                        return true;
        }

        return false;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a7abfd5d8bcc71fcdd072e9bde1e4af57_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a7abfd5d8bcc71fcdd072e9bde1e4af57_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_ad2df8506697f9836ecdb05f2271dafb1}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Location\-Buildable@{is\-Location\-Buildable}}
\index{is\-Location\-Buildable@{is\-Location\-Buildable}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Location\-Buildable}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Location\-Buildable} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{position, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type, }
\item[{bool}]{ignore\-Reservations = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_ad2df8506697f9836ecdb05f2271dafb1}


\-Definition at line 417 of file \-Building\-Placer.\-cpp.



\-References \-Access\-Type\-Def\-::\-Dead, \-Unit\-Helper\-::has\-Addon(), \-Singleton$<$ T $>$\-::\-Instance(), is\-Addon\-Buildable(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Refinery(), is\-Reserved(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Resource\-Depot(), is\-Tile\-Buildable(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::requires\-Psi(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::tile\-Height(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::tile\-Width(), \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by is\-Location\-Non\-Blocking(), and remember\-Best\-Expand\-Location().


\begin{DoxyCode}
{
        if(type.isRefinery())
        {
                for each(Unit geyser in UnitTracker::Instance().getGeysers())
                {
                        if(geyser->getTilePosition() == position)
                        {
                                if(!ignoreReservations)
                                {
                                        for(int x = position.x(); x < position.x
      () + type.tileWidth(); ++x)
                                        {
                                                for(int y = position.y(); y < 
      position.y() + type.tileHeight(); ++y)
                                                {
                                                        if(isReserved(x, y))
                                                                return false;
                                                }
                                        }
                                }

                                return true;
                        }
                }

                return false;
        }

        for(int x = position.x(); x < position.x() + type.tileWidth(); ++x)
        {
                for(int y = position.y(); y < position.y() + type.tileHeight();
       ++y)
                {
                        if(!isTileBuildable(TilePosition(x, y), type, 
      ignoreReservations))
                                return false;
                }
        }

        if(type.isResourceDepot())
        {
                for each(Unit mineral in UnitTracker::Instance().getMinerals())
                {
                        if(mineral->accessibility() != AccessType::Dead)
                        {
                                if (mineral->getTilePosition().x() > position.x
      () - 5 &&
                                        mineral->getTilePosition().y() > 
      position.y() - 4 &&
                                        mineral->getTilePosition().x() < 
      position.x() + 7 &&
                                        mineral->getTilePosition().y() < 
      position.y() + 6)
                                {
                                        return false;
                                }
                        }
                }
                for each(Unit geyser in UnitTracker::Instance().getGeysers())
                {
                        if(geyser->accessibility() != AccessType::Dead)
                        {
                                if (geyser->getTilePosition().x() > position.x(
      ) - 7 &&
                                        geyser->getTilePosition().y() > 
      position.y() - 5 &&
                                        geyser->getTilePosition().x() < 
      position.x() + 7 &&
                                        geyser->getTilePosition().y() < 
      position.y() + 6)
                                {
                                        return false;
                                }
                        }
                }
        }

        if(type.requiresPsi())
        {
                if(!PylonPowerTracker::Instance().hasPower(position, type))
                        return false;
        }

        /* If this has an addon, make sure there is space to build it */
        if(UnitHelper::hasAddon(type) && !isAddonBuildable(position))
                return false;

        /* Put some extra space between the first 6 pylons*/
        /*if(type == BWAPI::UnitTypes::Protoss_Pylon)
        {
                UnitGroup ug = SelectAll(BWAPI::UnitTypes::Protoss_Pylon);
                if(ug.size() < 6)
                {
                        ug = ug.inRadius(8 * 32, position);

                        if(ug.size() != 0)
                                return false;
                }
        }*/

        return true;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_ad2df8506697f9836ecdb05f2271dafb1_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_ad2df8506697f9836ecdb05f2271dafb1_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_af9969b53415412ac0779a2dc0e0cd2b1}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Location\-Non\-Blocking@{is\-Location\-Non\-Blocking}}
\index{is\-Location\-Non\-Blocking@{is\-Location\-Non\-Blocking}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Location\-Non\-Blocking}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Location\-Non\-Blocking} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{position, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type, }
\item[{bool}]{ignore\-Reservations = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_af9969b53415412ac0779a2dc0e0cd2b1}


\-Definition at line 304 of file \-Building\-Placer.\-cpp.



\-References \-Map\-Helper\-::flood\-Fill(), get\-Surrounding\-Tiles(), \-Singleton$<$ T $>$\-::\-Instance(), is\-Location\-Buildable(), \-Unit\-Helper\-::unit\-Produces\-Ground(), \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().


\begin{DoxyCode}
{
        if(!isLocationBuildable(position, type, ignoreReservations))
                return false;

        std::set<TilePosition> targets = getSurroundingTiles(position, type, 
      ignoreReservations);

        /* If there are no surrounding tiles, it's probably impossible to reach
       the build site */
        if(targets.empty())
                return false;

        /* Don't build on choke tiles, they are vital for the calculation */
        Region region = TerrainAnaysis::Instance().getRegion(position);
        const std::set<TilePosition> &chokeTiles = region->getChokepointTiles()
      ;
        for each(TilePosition tile in chokeTiles)
        {
                if(tile.x() >= position.x() && tile.x() < position.x() + type.
      tileWidth() && tile.y() >= position.y() && tile.y() < position.y() + type.
      tileHeight())
                        return false;

                targets.insert(tile);
        }

        /* Start from one of the chokes */
        TilePosition startTile = *chokeTiles.begin();

        /* Ignore the tiles we are building on as we cant path though this
       building */
        std::set<TilePosition> ignoreTiles;
        for(int x = position.x(); x < position.x() + type.tileWidth(); ++x)
                for(int y = position.y(); y < position.y() + type.tileHeight();
       ++y)
                        ignoreTiles.insert(TilePosition(x, y));

        /* Don't block other buildings */
        for each(Unit unit in UnitTracker::Instance().getAllUnits())
        {
                if(unit->exists() && !unit->getType().canProduce())
                        continue;

                /* Refineries are ok as they will be protected by resource
       reservation */
                if(unit->getType().isRefinery())
                        continue;

                if(UnitHelper::unitProducesGround(unit->getType()))
                {
                        /* 2 is no location found yet */
                        int isBlocked = 2;
                        for each(TilePosition tile in getSurroundingTiles(unit
      ->getTilePosition(), unit->getType(), ignoreReservations))
                        {
                                if(TerrainAnaysis::Instance().getRegion(tile) =
      = region)
                                {
                                        /* If this location is touching this
       building, ensure we don't block all exits */
                                        if(ignoreTiles.find(tile) != 
      ignoreTiles.end())
                                                isBlocked = (isBlocked==0?0:1);
                                        else
                                        {
                                                /* This tile is not blocked, we
       can touch this building here */
                                                targets.insert(tile);
                                                isBlocked = 0;
                                        }
                                }
                        }

                        /* Building here will stop units being able to exit
       this building */
                        if(isBlocked == 1)
                                return false;
                }
        }

        /* Check which tiles can be reached */
        targets = MapHelper::floodFill(startTile, RegionChokeCompare(
      ignoreReservations, region), targets, ignoreTiles);

        /* If there are no remaining targets, there are all reachable */
        if(targets.empty())
                return true;

        /* Check if we could reach these positions before */
        std::set<TilePosition> newTargets = MapHelper::floodFill(startTile, 
      RegionChokeCompare(ignoreReservations, region), targets);

        /* If they are the same, they were never reachable */
        if(targets == newTargets)
        {
                //if(m_bShowDebugInfo)
//              {
//                      
      DrawBuffer::Instance().clearBuffer(BufferedCategory::BuildingPlacer);
//                      for each(TilePosition tile in targets)
//                              
      DrawBuffer::Instance().drawBufferedCircle(BWAPI::CoordinateType::Map, tile.x()*32+16, tile.y()*32+16, 16, 240,
       BWAPI::Colors::Red, false, BufferedCategory::BuildingPlacer);
// 
//                      for(int x = position.x(); x < position.x() +
       type.tileWidth(); ++x)
//                              for(int y = position.y(); y < position.y() +
       type.tileHeight(); ++y)
//                                      
      DrawBuffer::Instance().drawBufferedCircle(BWAPI::CoordinateType::Map, x*32+16, y*32+16, 16, 240, BWAPI::Colors::White,
       false, BufferedCategory::BuildingPlacer);
//              }

                return true;
        }

        //if(m_bShowDebugInfo)
//      {
//              
      DrawBuffer::Instance().clearBuffer(BufferedCategory::BuildingPlacer);
//              for each(TilePosition tile in targets)
//                      
      DrawBuffer::Instance().drawBufferedCircle(BWAPI::CoordinateType::Map, tile.x()*32+16, tile.y()*32+16, 16, 240, BWAPI::Colors::Red,
       false, BufferedCategory::BuildingPlacer);
// 
//              for each(TilePosition tile in newTargets)
//                      
      DrawBuffer::Instance().drawBufferedCircle(BWAPI::CoordinateType::Map, tile.x()*32+16, tile.y()*32+16, 16, 240, BWAPI::Colors::Yellow,
       false, BufferedCategory::BuildingPlacer);
// 
//              for(int x = position.x(); x < position.x() + type.tileWidth();
       ++x)
//                      for(int y = position.y(); y < position.y() +
       type.tileHeight(); ++y)
//                              
      DrawBuffer::Instance().drawBufferedCircle(BWAPI::CoordinateType::Map, x*32+16, y*32+16, 16, 240, BWAPI::Colors::White, false,
       BufferedCategory::BuildingPlacer);
// 
//              
      DrawBuffer::Instance().drawBufferedCircle(BWAPI::CoordinateType::Map, startTile.x()*32+16, startTile.y()*32+16, 16, 240, BWAPI::Colors::Green,
       false, BufferedCategory::BuildingPlacer);
//      }

        return false;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_af9969b53415412ac0779a2dc0e0cd2b1_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a5ff79bc3f2ad9825653a45a191b389bb}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Reserved@{is\-Reserved}}
\index{is\-Reserved@{is\-Reserved}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Reserved}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Reserved} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{position}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a5ff79bc3f2ad9825653a45a191b389bb}


\-Definition at line 185 of file \-Building\-Placer.\-cpp.



\-References m\-Reserved\-Tiles.



\-Referenced by get\-Refinery\-Location(), is\-Location\-Buildable(), is\-Reserved(), and is\-Tile\-Blocked().


\begin{DoxyCode}
{
        return mReservedTiles.find(position) != mReservedTiles.end();
}
\end{DoxyCode}


\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a5ff79bc3f2ad9825653a45a191b389bb_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a1b7b0f9f503b5ceebfe0a0a02365d3a0}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Reserved@{is\-Reserved}}
\index{is\-Reserved@{is\-Reserved}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Reserved}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Reserved} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a1b7b0f9f503b5ceebfe0a0a02365d3a0}


\-Definition at line 190 of file \-Building\-Placer.\-cpp.



\-References is\-Reserved().


\begin{DoxyCode}
{
        return isReserved(TilePosition(x, y));
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a1b7b0f9f503b5ceebfe0a0a02365d3a0_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_af27a8a1e2bf3e793d565e74fa4b609b0}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Resource\-Reserved@{is\-Resource\-Reserved}}
\index{is\-Resource\-Reserved@{is\-Resource\-Reserved}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Resource\-Reserved}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Resource\-Reserved} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{position}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_af27a8a1e2bf3e793d565e74fa4b609b0}


\-Definition at line 195 of file \-Building\-Placer.\-cpp.



\-References m\-Resource\-Reserved.



\-Referenced by is\-Resource\-Reserved(), and is\-Tile\-Blocked().


\begin{DoxyCode}
{
        return mResourceReserved.find(position) != mResourceReserved.end();
}
\end{DoxyCode}


\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_af27a8a1e2bf3e793d565e74fa4b609b0_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_af4964eae7fdac27b9e505507ae123909}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Resource\-Reserved@{is\-Resource\-Reserved}}
\index{is\-Resource\-Reserved@{is\-Resource\-Reserved}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Resource\-Reserved}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Resource\-Reserved} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_af4964eae7fdac27b9e505507ae123909}


\-Definition at line 200 of file \-Building\-Placer.\-cpp.



\-References is\-Resource\-Reserved().


\begin{DoxyCode}
{
        return isResourceReserved(TilePosition(x, y));
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_af4964eae7fdac27b9e505507ae123909_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a19c980cdc42f9c30683373001d067b62}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Tile\-Blocked@{is\-Tile\-Blocked}}
\index{is\-Tile\-Blocked@{is\-Tile\-Blocked}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Tile\-Blocked}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Tile\-Blocked} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{tile, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type, }
\item[{bool}]{ignore\-Reservations = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a19c980cdc42f9c30683373001d067b62}


\-Definition at line 509 of file \-Building\-Placer.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-Singleton$<$ T $>$\-::\-Instance(), is\-Addon\-Builder(), is\-Reserved(), is\-Resource\-Reserved(), \-Unit\-Helper\-::is\-Static\-Defense(), m\-Permanent\-Reserved, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Resource\-\_\-\-Vespene\-\_\-\-Geyser, \-B\-W\-A\-P\-I\-::\-Races\-::\-Terran, \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by is\-Tile\-Buildable(), and is\-Tile\-Walkable().


\begin{DoxyCode}
{
        if(!ignoreReservations)
        {
                if(isReserved(tile) || (!UnitHelper::isStaticDefense(type) && 
      isResourceReserved(tile)))
                        return true;

                std::map<TilePosition, BWAPI::UnitType>::const_iterator it = 
      mPermanentReserved.find(tile);
                if(it != mPermanentReserved.end())
                        if(it->second != type)
                                return true;
        }

        for each(Unit unit in UnitTracker::Instance().getUnitsOnTile(tile.x(), 
      tile.y()))
        {
                if(!unit->exists())
                        continue;

                if(unit->getType().isBuilding() && !unit->isLifted())
                        return true;

                if(!type.isRefinery() && unit->getType() == 
      BWAPI::UnitTypes::Resource_Vespene_Geyser)
                        return true;

                if(!unit->getType().canMove())
                        return true;
        }

        if(BWAPI::Broodwar->self()->getRace() == BWAPI::Races::Terran && !type.
      isAddon())
        {
                if(tile.x()-1 >= 0)
                        if(isAddonBuilder(tile.x()-1, tile.y()))
                                return true;
                if(tile.x()-2 >= 0)
                        if(isAddonBuilder(tile.x()-2, tile.y()))
                                return true;
        }

        return false;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a19c980cdc42f9c30683373001d067b62_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a19c980cdc42f9c30683373001d067b62_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a724f8d7d767e727e96ece195ccca62c6}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Tile\-Buildable@{is\-Tile\-Buildable}}
\index{is\-Tile\-Buildable@{is\-Tile\-Buildable}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Tile\-Buildable}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Tile\-Buildable} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{tile, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type, }
\item[{bool}]{ignore\-Reservations = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a724f8d7d767e727e96ece195ccca62c6}


\-Definition at line 550 of file \-Building\-Placer.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::get\-Race(), \-B\-W\-A\-P\-I\-::\-Game\-::has\-Creep(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Resource\-Depot(), is\-Tile\-Blocked(), and \-B\-W\-A\-P\-I\-::\-Races\-::\-Zerg.



\-Referenced by is\-Addon\-Buildable(), and is\-Location\-Buildable().


\begin{DoxyCode}
{
        if(!BWAPI::Broodwar->isBuildable(tile))
                return false;

        if(type.getRace() == BWAPI::Races::Zerg)
        {
                if(!type.isResourceDepot() && !BWAPI::Broodwar->hasCreep(tile))
                        return false;
        }
        else if(BWAPI::Broodwar->hasCreep(tile))
                return false;

        return !isTileBlocked(tile, type, ignoreReservations);
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a724f8d7d767e727e96ece195ccca62c6_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a724f8d7d767e727e96ece195ccca62c6_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a0b67c3238e347f4a141db5d268851c20}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!is\-Tile\-Walkable@{is\-Tile\-Walkable}}
\index{is\-Tile\-Walkable@{is\-Tile\-Walkable}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{is\-Tile\-Walkable}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Building\-Placer\-Class\-::is\-Tile\-Walkable} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{tile, }
\item[{bool}]{ignore\-Reservations = {\ttfamily false}}
\end{DoxyParamCaption}
) const}}\label{classBuildingPlacerClass_a0b67c3238e347f4a141db5d268851c20}


\-Definition at line 566 of file \-Building\-Placer.\-cpp.



\-References is\-Tile\-Blocked(), \-Map\-Helper\-::is\-Tile\-Walkable(), and \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-None.



\-Referenced by get\-Surrounding\-Tiles().


\begin{DoxyCode}
{
        if(!MapHelper::isTileWalkable(tile))
                return false;

        return !isTileBlocked(tile, BWAPI::UnitTypes::None, ignoreReservations)
      ;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a0b67c3238e347f4a141db5d268851c20_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a0b67c3238e347f4a141db5d268851c20_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a595c37835428cb2c56a67595c0cb5ebd}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!on\-Destroy@{on\-Destroy}}
\index{on\-Destroy@{on\-Destroy}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{on\-Destroy}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::on\-Destroy} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a595c37835428cb2c56a67595c0cb5ebd}


\-Definition at line 124 of file \-Building\-Placer.\-cpp.



\-References m\-Resource\-Reserved, and m\-Resources.


\begin{DoxyCode}
{
        if(mResources.count(unit) != 0)
        {
                for each(TilePosition tile in mResources[unit])
                {
                        --mResourceReserved[tile];
                        if(mResourceReserved[tile] == 0)
                                mResourceReserved.erase(tile);
                }

                mResources.erase(unit);
        }
}
\end{DoxyCode}
\hypertarget{classBuildingPlacerClass_afbaa3d482a439e5e3f7a67a7d7c2b568}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!remember\-Best\-Expand\-Location@{remember\-Best\-Expand\-Location}}
\index{remember\-Best\-Expand\-Location@{remember\-Best\-Expand\-Location}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{remember\-Best\-Expand\-Location}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::remember\-Best\-Expand\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Base}}]{base, }
\item[{{\bf \-Base} \&}]{best\-Base, }
\item[{int \&}]{closest\-Distance, }
\item[{int \&}]{furthest\-Distance, }
\item[{{\bf \-Expand\-Type} \&}]{type, }
\item[{bool}]{gas, }
\item[{std\-::set$<$ {\bf \-Base} $>$}]{enemy\-Bases}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBuildingPlacerClass_afbaa3d482a439e5e3f7a67a7d7c2b568}


\-Definition at line 823 of file \-Building\-Placer.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-Scout\-Type\-Def\-::\-Failed\-With\-Air, \-Scout\-Type\-Def\-::\-Failed\-With\-Ground\-High, \-Scout\-Type\-Def\-::\-Failed\-With\-Ground\-Low, \-B\-W\-A\-P\-I\-::\-Race\-::get\-Center(), \-Map\-Helper\-::get\-Ground\-Distance(), \-B\-W\-A\-P\-I\-::\-Player\-::get\-Race(), \-B\-W\-A\-P\-I\-::\-Races\-::get\-Race(), \-Singleton$<$ T $>$\-::\-Instance(), is\-Location\-Buildable(), \-B\-W\-A\-P\-I\-::\-Bullet\-Types\-::\-None, and \-B\-W\-A\-P\-I\-::\-Game\-::self().



\-Referenced by get\-Expand\-Location().


\begin{DoxyCode}
{
        if(base->getPlayer() == NULL || (!base->isActive() && base->getPlayer()
       == BWAPI::Broodwar->self()))
        {
                if(base->getCenterBuildLocation() == BWAPI::TilePositions::None
      )
                        return;

                if(gas && base->getGeysers().empty() && base->getRefineries().
      empty())
                        return;

                if(base->isMinedOut())
                        return;

                if(base->isMyBase() && base->isUnderAttack())
                        return;

                ScoutType lastScoutType = ScoutManager::Instance().
      getLastScoutType(base);
                int lastScoutTime = ScoutManager::Instance().getLastScoutTime(
      base);
                if(BWAPI::Broodwar->getFrameCount() > 6200 && (lastScoutType ==
       ScoutType::FailedWithGroundLow || lastScoutType == 
      ScoutType::FailedWithGroundHigh || lastScoutType == ScoutType::FailedWithAir))
                        return;

                //TODO: when we have transport code, remove this if we have a
       transport
                bool isConnected = false;
                for each(Unit unit in UnitTracker::Instance().selectAllUnits(
      BWAPI::Broodwar->self()->getRace().getWorker()))
                {
                        if(unit->hasPath(Position(base->getCenterBuildLocation(
      ))))
                        {
                                isConnected = true;
                                break;
                        }
                }

                if(!isConnected)
                        return;

                if(isLocationBuildable(base->getCenterBuildLocation(), 
      BWAPI::Broodwar->self()->getRace().getCenter()))
                {
                        for each(Base myBase in BaseTracker::Instance().
      getPlayerBases())
                        {
                                if(myBase->getCenterBuildLocation() == 
      BWAPI::TilePositions::None)
                                        continue;

                                int tDistance = MapHelper::getGroundDistance(
      base->getCenterLocation(), myBase->getCenterLocation());
                                if(tDistance >= 1450 && type != 
      ExpandType::expCloseToMe && !enemyBases.empty())
                                {
                                        for each(Base enemyBase in enemyBases)
                                        {
                                                int enemyDistance = 
      MapHelper::getGroundDistance(base->getCenterLocation(), enemyBase->
      getCenterLocation());
                                                if(enemyDistance > 
      furthestDistance)
                                                {
                                                        furthestDistance = 
      enemyDistance;
                                                        bestBase = base;
                                                        type = 
      ExpandType::expFurthestFromEnemy;
                                                }
                                        }
                                }
                                else if(tDistance < closestDistance)
                                {
                                        closestDistance = tDistance;
                                        bestBase = base;
                                        type = ExpandType::expCloseToMe;
                                }
                        }
                }
        }
}\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_afbaa3d482a439e5e3f7a67a7d7c2b568_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_afbaa3d482a439e5e3f7a67a7d7c2b568_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a202e9d94cf4546cd07df7b70703ecf08}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!reserve@{reserve}}
\index{reserve@{reserve}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{reserve}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::reserve} (
\begin{DoxyParamCaption}
\item[{{\bf \-Reserved\-Location}}]{location}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a202e9d94cf4546cd07df7b70703ecf08}


\-Definition at line 139 of file \-Building\-Placer.\-cpp.



\-References \-Unit\-Helper\-::has\-Addon(), and m\-Reserved\-Tiles.


\begin{DoxyCode}
{
        int startx = location->getTilePosition().x();
        int starty = location->getTilePosition().y();

        int endx = startx + location->getUnitType().tileWidth();
        int endy = starty + location->getUnitType().tileHeight();

        if(UnitHelper::hasAddon(location->getUnitType()))
                endx += 2;

        for(int x = startx; x < endx; ++x)
                for(int y = starty; y < endy; ++y)
                        mReservedTiles[TilePosition(x, y)] = location;
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a202e9d94cf4546cd07df7b70703ecf08_cgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a844a743f1b9992483da28ce34821898d}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!reserve\-Resource\-Space@{reserve\-Resource\-Space}}
\index{reserve\-Resource\-Space@{reserve\-Resource\-Space}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{reserve\-Resource\-Space}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::reserve\-Resource\-Space} (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{resources, }
\item[{{\bf \-Base}}]{base}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a844a743f1b9992483da28ce34821898d}


\-Definition at line 76 of file \-Building\-Placer.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Position\-::get\-Approx\-Distance(), m\-Permanent\-Reserved, m\-Resource\-Reserved, and m\-Resources.



\-Referenced by calculate\-Reservations().


\begin{DoxyCode}
{
        for each(Unit resource in resources)
        {
                int distanceBetween = (resource->getPosition().
      getApproxDistance(base->getCenterLocation()) / 32) + 1;
                for(int x = resource->getTilePosition().x() - int(
      distanceBetween); x < resource->getTilePosition().x() + int(distanceBetween) + 4; ++x)
                {
                        for(int y = resource->getTilePosition().y() - int(
      distanceBetween); y < resource->getTilePosition().y() + int(distanceBetween) + 3; ++y
      )
                        {
                                int distanceToResource = Position(x*32+16, y*32
      +16).getApproxDistance(resource->getPosition()) / 32;
                                int distanceToBase = Position(x*32+16, y*32+16)
      .getApproxDistance(base->getCenterLocation()) / 32;

                                if(distanceToResource + distanceToBase < 
      distanceBetween && mPermanentReserved.count(TilePosition(x, y)) == 0)
                                {
                                        if(resource->getType().isMineralField()
      )
                                                mResources[resource].insert(
      TilePosition(x, y));

                                        ++mResourceReserved[TilePosition(x, y)]
      ;
                                }
                        }
                }
        }
}
\end{DoxyCode}


\-Here is the call graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a844a743f1b9992483da28ce34821898d_cgraph}
\end{center}
\end{figure}




\-Here is the caller graph for this function\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classBuildingPlacerClass_a844a743f1b9992483da28ce34821898d_icgraph}
\end{center}
\end{figure}


\hypertarget{classBuildingPlacerClass_a925031ca8831544c8787d658779e0bf8}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!update@{update}}
\index{update@{update}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Building\-Placer\-Class\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBuildingPlacerClass_a925031ca8831544c8787d658779e0bf8}


\-Definition at line 100 of file \-Building\-Placer.\-cpp.



\-References m\-Reserved\-Locations.


\begin{DoxyCode}
{
        for(std::set<ReservedLocation>::iterator it = mReservedLocations.begin(
      ); it != mReservedLocations.end();)
        {
                if((*it)->update())
                        mReservedLocations.erase(it++);
                else
                        ++it;
        }

//      for(std::map<TilePosition, BWAPI::UnitType>::iterator it =
       mPermanentReserved.begin(); it != mPermanentReserved.end(); ++it)
//      {
//              BWAPI::Broodwar->drawBox(BWAPI::CoordinateType::Map,
       it->first.x() * 32, it->first.y() * 32, it->first.x() * 32 + 32, it->first.y() * 32 + 32,
       BWAPI::Colors::Red);
//      }
//      for(std::map<TilePosition, int>::iterator it =
       mResourceReserved.begin(); it != mResourceReserved.end(); ++it)
//      {
//              BWAPI::Broodwar->drawCircle(BWAPI::CoordinateType::Map,
       it->first.x()*32+16, it->first.y()*32+16, 16, BWAPI::Colors::Blue);
//      }
//      for(std::map<TilePosition, ReservedLocation>::iterator it =
       mReservedTiles.begin(); it != mReservedTiles.end(); ++it)
//      {
//              BWAPI::Broodwar->drawBox(BWAPI::CoordinateType::Map,
       it->first.x() * 32, it->first.y() * 32, it->first.x() * 32 + 32, it->first.y() * 32 + 32,
       BWAPI::Colors::Red);
//      }
}
\end{DoxyCode}


\subsection{\-Member \-Data \-Documentation}
\hypertarget{classBuildingPlacerClass_ac057090be47ef08890225f6e313d2bc9}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!m\-Permanent\-Reserved@{m\-Permanent\-Reserved}}
\index{m\-Permanent\-Reserved@{m\-Permanent\-Reserved}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{m\-Permanent\-Reserved}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Tile\-Position}, {\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}$>$ {\bf \-Building\-Placer\-Class\-::m\-Permanent\-Reserved}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBuildingPlacerClass_ac057090be47ef08890225f6e313d2bc9}


\-Definition at line 70 of file \-Building\-Placer.\-h.



\-Referenced by calculate\-Reservations(), finalise\-Reservations(), is\-Addon\-Builder(), is\-Tile\-Blocked(), and reserve\-Resource\-Space().

\hypertarget{classBuildingPlacerClass_acab0dc50f00cd3bae8d9c32eb57cf4bc}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!m\-Reserved\-Locations@{m\-Reserved\-Locations}}
\index{m\-Reserved\-Locations@{m\-Reserved\-Locations}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{m\-Reserved\-Locations}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<${\bf \-Reserved\-Location}$>$ {\bf \-Building\-Placer\-Class\-::m\-Reserved\-Locations}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBuildingPlacerClass_acab0dc50f00cd3bae8d9c32eb57cf4bc}


\-Definition at line 74 of file \-Building\-Placer.\-h.



\-Referenced by get\-Building\-Reservation(), get\-Landing\-Reservation(), and update().

\hypertarget{classBuildingPlacerClass_af849a1f4e81b8e25b1feb620233e0bd3}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!m\-Reserved\-Tiles@{m\-Reserved\-Tiles}}
\index{m\-Reserved\-Tiles@{m\-Reserved\-Tiles}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{m\-Reserved\-Tiles}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Tile\-Position}, {\bf \-Reserved\-Location}$>$ {\bf \-Building\-Placer\-Class\-::m\-Reserved\-Tiles}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBuildingPlacerClass_af849a1f4e81b8e25b1feb620233e0bd3}


\-Definition at line 75 of file \-Building\-Placer.\-h.



\-Referenced by free(), is\-Reserved(), and reserve().

\hypertarget{classBuildingPlacerClass_a262ba1988a001c81810648bfbf609c84}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!m\-Resource\-Reserved@{m\-Resource\-Reserved}}
\index{m\-Resource\-Reserved@{m\-Resource\-Reserved}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{m\-Resource\-Reserved}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Tile\-Position}, int$>$ {\bf \-Building\-Placer\-Class\-::m\-Resource\-Reserved}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBuildingPlacerClass_a262ba1988a001c81810648bfbf609c84}


\-Definition at line 71 of file \-Building\-Placer.\-h.



\-Referenced by is\-Resource\-Reserved(), on\-Destroy(), and reserve\-Resource\-Space().

\hypertarget{classBuildingPlacerClass_a50b9843c5143a22141d7f7c386fb1ba0}{\index{\-Building\-Placer\-Class@{\-Building\-Placer\-Class}!m\-Resources@{m\-Resources}}
\index{m\-Resources@{m\-Resources}!BuildingPlacerClass@{\-Building\-Placer\-Class}}
\subsubsection[{m\-Resources}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Unit}, std\-::set$<${\bf \-Tile\-Position}$>$ $>$ {\bf \-Building\-Placer\-Class\-::m\-Resources}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBuildingPlacerClass_a50b9843c5143a22141d7f7c386fb1ba0}


\-Definition at line 72 of file \-Building\-Placer.\-h.



\-Referenced by on\-Destroy(), and reserve\-Resource\-Space().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{BuildingPlacer_8h}{\-Building\-Placer.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{BuildingPlacer_8cpp}{\-Building\-Placer.\-cpp}\end{DoxyCompactItemize}
