\hypertarget{classBlockedPathManagerClass}{\section{\-Blocked\-Path\-Manager\-Class \-Class \-Reference}
\label{classBlockedPathManagerClass}\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}}
}


{\ttfamily \#include $<$\-Blocked\-Path\-Manager.\-h$>$}

\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classBlockedPathManagerClass_af840ca5169a07d884c0fddf145c9b3d2}{\-Blocked\-Path\-Manager\-Class} ()
\item 
void \hyperlink{classBlockedPathManagerClass_a3d18bb5f3fbb7e138c25fd1c0f5a1534}{on\-Begin} ()
\item 
void \hyperlink{classBlockedPathManagerClass_a4da77a8c3ea0b93b21e4b0f91060e386}{update} ()
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
std\-::map$<$ \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base}, \hyperlink{classUnitGroup}{\-Unit\-Group} $>$ \hyperlink{classBlockedPathManagerClass_ab11e7dba7e91d1c157600e6af70e81ed}{m\-Blocking\-Minerals}
\item 
std\-::set$<$ \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} $>$ \hyperlink{classBlockedPathManagerClass_a27064f6a8cbcf6b8e862e8b57a61c0bc}{m\-My\-Bases}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 9 of file \-Blocked\-Path\-Manager.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classBlockedPathManagerClass_af840ca5169a07d884c0fddf145c9b3d2}{\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}!\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}}
\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}!BlockedPathManagerClass@{\-Blocked\-Path\-Manager\-Class}}
\subsubsection[{\-Blocked\-Path\-Manager\-Class}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Blocked\-Path\-Manager\-Class\-::\-Blocked\-Path\-Manager\-Class} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBlockedPathManagerClass_af840ca5169a07d884c0fddf145c9b3d2}


\-Definition at line 12 of file \-Blocked\-Path\-Manager.\-cpp.


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


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classBlockedPathManagerClass_a3d18bb5f3fbb7e138c25fd1c0f5a1534}{\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}!on\-Begin@{on\-Begin}}
\index{on\-Begin@{on\-Begin}!BlockedPathManagerClass@{\-Blocked\-Path\-Manager\-Class}}
\subsubsection[{on\-Begin}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Blocked\-Path\-Manager\-Class\-::on\-Begin} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBlockedPathManagerClass_a3d18bb5f3fbb7e138c25fd1c0f5a1534}


\-Definition at line 16 of file \-Blocked\-Path\-Manager.\-cpp.



\-References \-Singleton$<$ T $>$\-::\-Instance(), m\-Blocking\-Minerals, \-B\-W\-A\-P\-I\-::\-Bullet\-Types\-::\-None, \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().


\begin{DoxyCode}
{
        for each(Unit mineral in UnitTracker::Instance().getMinerals())
        {
                if(mineral->getResources() <= 1)
                {
                        const TilePosition &mineralTile = mineral->
      getTilePosition();
                        Base base = BaseTracker::Instance().getBase(mineralTile
      );

                        bool isBlocking = false;
                        if(base)
                        {
                                const TilePosition &baseTile = base->
      getCenterBuildLocation();

                                isBlocking = (mineralTile.x() > baseTile.x() - 
      5 &&
                                                                   mineralTile.y
      () > baseTile.y() - 4 &&
                                                                   mineralTile.x
      () < baseTile.x() + 7 &&
                                                                   mineralTile.y
      () < baseTile.y() + 6);
                        }

                        if(!isBlocking)
                        {
                                const Position &mineralPos = mineral->
      getPosition();

                                Chokepoint closestChoke;
                                int closestDistance = 
      std::numeric_limits<int>::max();
                                for each(Chokepoint chokepoint in 
      TerrainAnaysis::Instance().getChokepoints())
                                {
                                        int distance = chokepoint->getCenter().
      getApproxDistance(mineralPos);
                                        if(distance < closestDistance)
                                        {
                                                closestChoke = chokepoint;
                                                closestDistance = distance;
                                        }
                                }

                                if(closestChoke)
                                {
                                        std::set<Base> bases;
                                        bases.insert(closestChoke->getRegions()
      .first->getBases().begin(), closestChoke->getRegions().first->getBases().end());
                                        bases.insert(closestChoke->getRegions()
      .second->getBases().begin(), closestChoke->getRegions().second->getBases().end()
      );

                                        Base closestBase;
                                        int closestDistance = 
      std::numeric_limits<int>::max();
                                        for each(Base base in bases)
                                        {
                                                if(base->isStartLocation())
                                                        continue;

                                                if(base->getCenterBuildLocation
      () == BWAPI::TilePositions::None)
                                                        continue;

                                                int distance = Position(base->
      getCenterBuildLocation()).getApproxDistance(mineralPos);
                                                if(distance < closestDistance)
                                                {
                                                        closestDistance = 
      distance;
                                                        closestBase = base;
                                                }
                                        }

                                        if(closestBase)
                                        {
                                                base = closestBase;
                                                isBlocking = true;
                                        }
                                }
                        }

                        if(isBlocking)
                                mBlockingMinerals[base].insert(mineral);
                }
        }
}
\end{DoxyCode}


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


\hypertarget{classBlockedPathManagerClass_a4da77a8c3ea0b93b21e4b0f91060e386}{\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}!update@{update}}
\index{update@{update}!BlockedPathManagerClass@{\-Blocked\-Path\-Manager\-Class}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Blocked\-Path\-Manager\-Class\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classBlockedPathManagerClass_a4da77a8c3ea0b93b21e4b0f91060e386}


\-Definition at line 90 of file \-Blocked\-Path\-Manager.\-cpp.



\-References \-Task\-Type\-Def\-::\-Expansion, \-Singleton$<$ T $>$\-::\-Instance(), m\-Blocking\-Minerals, and m\-My\-Bases.


\begin{DoxyCode}
{
        const std::set<Base> &myBases = BaseTracker::Instance().getActiveBases(
      true);
        if(myBases != mMyBases)
        {
                mMyBases = myBases;

                for each(Base base in mMyBases)
                {
                        if(mBlockingMinerals.count(base) != 0)
                        {
                                TaskPointer task = TaskPointer(new 
      MineBlockingMineralTask(TaskType::Expansion, mBlockingMinerals[base]));
                                TaskManager::Instance().addTask(task);

                                mBlockingMinerals.erase(base);
                        }
                }

                Base nextExpansion = BuildingPlacer::Instance().
      getExpandLocation().second;
                if(nextExpansion)
                {
                        if(mBlockingMinerals.count(nextExpansion) != 0)
                        {
                                TaskPointer task = TaskPointer(new 
      MineBlockingMineralTask(TaskType::Expansion, mBlockingMinerals[nextExpansion]))
      ;
                                TaskManager::Instance().addTask(task);

                                mBlockingMinerals.erase(nextExpansion);
                        }
                }
        }
}\end{DoxyCode}


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




\subsection{\-Member \-Data \-Documentation}
\hypertarget{classBlockedPathManagerClass_ab11e7dba7e91d1c157600e6af70e81ed}{\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}!m\-Blocking\-Minerals@{m\-Blocking\-Minerals}}
\index{m\-Blocking\-Minerals@{m\-Blocking\-Minerals}!BlockedPathManagerClass@{\-Blocked\-Path\-Manager\-Class}}
\subsubsection[{m\-Blocking\-Minerals}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Base}, {\bf \-Unit\-Group}$>$ {\bf \-Blocked\-Path\-Manager\-Class\-::m\-Blocking\-Minerals}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBlockedPathManagerClass_ab11e7dba7e91d1c157600e6af70e81ed}


\-Definition at line 19 of file \-Blocked\-Path\-Manager.\-h.



\-Referenced by on\-Begin(), and update().

\hypertarget{classBlockedPathManagerClass_a27064f6a8cbcf6b8e862e8b57a61c0bc}{\index{\-Blocked\-Path\-Manager\-Class@{\-Blocked\-Path\-Manager\-Class}!m\-My\-Bases@{m\-My\-Bases}}
\index{m\-My\-Bases@{m\-My\-Bases}!BlockedPathManagerClass@{\-Blocked\-Path\-Manager\-Class}}
\subsubsection[{m\-My\-Bases}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<${\bf \-Base}$>$ {\bf \-Blocked\-Path\-Manager\-Class\-::m\-My\-Bases}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classBlockedPathManagerClass_a27064f6a8cbcf6b8e862e8b57a61c0bc}


\-Definition at line 21 of file \-Blocked\-Path\-Manager.\-h.



\-Referenced by update().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{BlockedPathManager_8h}{\-Blocked\-Path\-Manager.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{BlockedPathManager_8cpp}{\-Blocked\-Path\-Manager.\-cpp}\end{DoxyCompactItemize}
