\hypertarget{namespaceMapHelper}{\section{\-Map\-Helper \-Namespace \-Reference}
\label{namespaceMapHelper}\index{\-Map\-Helper@{\-Map\-Helper}}
}
\subsection*{\-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} \hyperlink{namespaceMapHelper_aa6fd14893a4f26dcb56929717ff84621}{spiral\-Search} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} start\-Location, std\-::tr1\-::function$<$ bool(\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position})$>$ test\-Function, int max\-Radius=0)
\item 
std\-::set$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$ \hyperlink{namespaceMapHelper_ad2a2bc441e341a604da6874da4870635}{flood\-Fill} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} start, std\-::tr1\-::function$<$ bool(\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position})$>$ test\-Function, std\-::set$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$ targets=std\-::set$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$(), std\-::set$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$ ignore\-Tiles=std\-::set$<$ \hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} $>$())
\item 
std\-::map$<$ \hyperlink{classWalkPosition}{\-Walk\-Position}, int $>$ \hyperlink{namespaceMapHelper_acb26af45e73545e02b22a3e650b3bd28}{walk\-Search} (\hyperlink{classWalkPosition}{\-Walk\-Position} start, std\-::tr1\-::function$<$ bool(\hyperlink{classWalkPosition}{\-Walk\-Position})$>$ test\-Function, std\-::set$<$ \hyperlink{classWalkPosition}{\-Walk\-Position} $>$ targets=std\-::set$<$ \hyperlink{classWalkPosition}{\-Walk\-Position} $>$(), std\-::set$<$ \hyperlink{classWalkPosition}{\-Walk\-Position} $>$ ignore\-Tiles=std\-::set$<$ \hyperlink{classWalkPosition}{\-Walk\-Position} $>$())
\item 
bool \hyperlink{namespaceMapHelper_a1080dc596d5e1f04b016580da391cd13}{is\-Any\-Visible} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} location, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type)
\item 
bool \hyperlink{namespaceMapHelper_a13b853b92e3529eedd2446980d3ad466}{is\-All\-Visible} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} location, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} type)
\item 
bool \hyperlink{namespaceMapHelper_aa01b878e12e57e63afcbfcb564a7cec0}{is\-Tile\-Walkable} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} location)
\item 
bool \hyperlink{namespaceMapHelper_a2043e6d86f96881a854c33feb481bca9}{is\-Tile\-Walkable} (int x, int y)
\item 
bool \hyperlink{namespaceMapHelper_adebbc5bfe75b49e11a2d4a789c865c00}{map\-Is} (std\-::string name)
\item 
int \hyperlink{namespaceMapHelper_adfa4943f969ca1021cd9dc6e2f812068}{get\-Ground\-Distance} (\hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} start, \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} end)
\end{DoxyCompactItemize}


\subsection{\-Function \-Documentation}
\hypertarget{namespaceMapHelper_ad2a2bc441e341a604da6874da4870635}{\index{\-Map\-Helper@{\-Map\-Helper}!flood\-Fill@{flood\-Fill}}
\index{flood\-Fill@{flood\-Fill}!MapHelper@{\-Map\-Helper}}
\subsubsection[{flood\-Fill}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Tile\-Position} $>$ {\bf \-Map\-Helper\-::flood\-Fill} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{start, }
\item[{std\-::tr1\-::function$<$ bool({\bf \-Tile\-Position})$>$}]{test\-Function, }
\item[{std\-::set$<$ {\bf \-Tile\-Position} $>$}]{targets = {\ttfamily std\-:\-:set$<${\bf \-Tile\-Position}$>$()}, }
\item[{std\-::set$<$ {\bf \-Tile\-Position} $>$}]{ignore\-Tiles = {\ttfamily std\-:\-:set$<${\bf \-Tile\-Position}$>$()}}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_ad2a2bc441e341a604da6874da4870635}


\-Definition at line 68 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::is\-Valid(), \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by \-Building\-Placer\-Class\-::is\-Location\-Non\-Blocking().


\begin{DoxyCode}
{
        bool noTargets = targets.empty();

        std::set<TilePosition> remainingTiles;
        remainingTiles.insert(start);

        while(!remainingTiles.empty())
        {
                if(!noTargets && targets.empty())
                        return targets;

                TilePosition tile = *remainingTiles.begin();

                ignoreTiles.insert(tile);
                remainingTiles.erase(tile);

                if(!tile.isValid())
                        continue;

                if(!testFunction(tile))
                        continue;

                if(noTargets)
                        targets.insert(tile);
                else
                        targets.erase(tile);

                if(ignoreTiles.count(TilePosition(tile.x() + 1, tile.y())) == 0
      )
                        remainingTiles.insert(TilePosition(tile.x() + 1, tile.y
      ()));
                if(ignoreTiles.count(TilePosition(tile.x() - 1, tile.y())) == 0
      )
                        remainingTiles.insert(TilePosition(tile.x() - 1, tile.y
      ()));
                if(ignoreTiles.count(TilePosition(tile.x(), tile.y() + 1)) == 0
      )
                        remainingTiles.insert(TilePosition(tile.x(), tile.y() +
       1));
                if(ignoreTiles.count(TilePosition(tile.x(), tile.y() - 1)) == 0
      )
                        remainingTiles.insert(TilePosition(tile.x(), tile.y() -
       1));
        }

        return targets;
}
\end{DoxyCode}


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




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


\hypertarget{namespaceMapHelper_adfa4943f969ca1021cd9dc6e2f812068}{\index{\-Map\-Helper@{\-Map\-Helper}!get\-Ground\-Distance@{get\-Ground\-Distance}}
\index{get\-Ground\-Distance@{get\-Ground\-Distance}!MapHelper@{\-Map\-Helper}}
\subsubsection[{get\-Ground\-Distance}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Map\-Helper\-::get\-Ground\-Distance} (
\begin{DoxyParamCaption}
\item[{{\bf \-Position}}]{start, }
\item[{{\bf \-Position}}]{end}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_adfa4943f969ca1021cd9dc6e2f812068}


\-Definition at line 225 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Position\-::get\-Approx\-Distance(), and \-Singleton$<$ T $>$\-::\-Instance().



\-Referenced by \-Scout\-Manager\-Class\-::on\-Begin(), and \-Building\-Placer\-Class\-::remember\-Best\-Expand\-Location().


\begin{DoxyCode}
{
        if(!BWAPI::Broodwar->hasPath(start, end))
                return std::numeric_limits<int>::max();

        int groundDistance = PathFinder::Instance().CreateCheapWalkPath(start, 
      end).getLength();
        int linearDistance = start.getApproxDistance(end);

        if(groundDistance < linearDistance)
                return linearDistance;

        return groundDistance;
}\end{DoxyCode}


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




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


\hypertarget{namespaceMapHelper_a13b853b92e3529eedd2446980d3ad466}{\index{\-Map\-Helper@{\-Map\-Helper}!is\-All\-Visible@{is\-All\-Visible}}
\index{is\-All\-Visible@{is\-All\-Visible}!MapHelper@{\-Map\-Helper}}
\subsubsection[{is\-All\-Visible}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Map\-Helper\-::is\-All\-Visible} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{location, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_a13b853b92e3529eedd2446980d3ad466}


\-Definition at line 179 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-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 \-Unit\-Class\-::build().


\begin{DoxyCode}
{
        for(int x = location.x(); x < location.x() + type.tileWidth(); ++x)
        {
                for(int y = location.y(); y < location.y() + type.tileHeight();
       ++y)
                {
                        if(!BWAPI::Broodwar->isVisible(x, y))
                                return false;
                }
        }

        return true;
}
\end{DoxyCode}


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




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


\hypertarget{namespaceMapHelper_a1080dc596d5e1f04b016580da391cd13}{\index{\-Map\-Helper@{\-Map\-Helper}!is\-Any\-Visible@{is\-Any\-Visible}}
\index{is\-Any\-Visible@{is\-Any\-Visible}!MapHelper@{\-Map\-Helper}}
\subsubsection[{is\-Any\-Visible}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Map\-Helper\-::is\-Any\-Visible} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{location, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{type}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_a1080dc596d5e1f04b016580da391cd13}


\-Definition at line 165 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-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 \-Unit\-Class\-::accessibility(), \-Scout\-Data\-Class\-::check\-Positions(), and \-Worker\-Scout\-Task\-::pre\-Update().


\begin{DoxyCode}
{
        for(int x = location.x(); x < location.x() + type.tileWidth(); ++x)
        {
                for(int y = location.y(); y < location.y() + type.tileHeight();
       ++y)
                {
                        if(BWAPI::Broodwar->isVisible(x, 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]{namespaceMapHelper_a1080dc596d5e1f04b016580da391cd13_cgraph}
\end{center}
\end{figure}




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


\hypertarget{namespaceMapHelper_aa01b878e12e57e63afcbfcb564a7cec0}{\index{\-Map\-Helper@{\-Map\-Helper}!is\-Tile\-Walkable@{is\-Tile\-Walkable}}
\index{is\-Tile\-Walkable@{is\-Tile\-Walkable}!MapHelper@{\-Map\-Helper}}
\subsubsection[{is\-Tile\-Walkable}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Map\-Helper\-::is\-Tile\-Walkable} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{location}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_aa01b878e12e57e63afcbfcb564a7cec0}


\-Definition at line 193 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by \-Build\-Tile\-Path\-::is\-Still\-Valid(), \-Building\-Placer\-Class\-::is\-Tile\-Walkable(), and \-Flee\-Tile\-Test\-::operator()().


\begin{DoxyCode}
{
        return isTileWalkable(location.x(), location.y());
}
\end{DoxyCode}


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




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


\hypertarget{namespaceMapHelper_a2043e6d86f96881a854c33feb481bca9}{\index{\-Map\-Helper@{\-Map\-Helper}!is\-Tile\-Walkable@{is\-Tile\-Walkable}}
\index{is\-Tile\-Walkable@{is\-Tile\-Walkable}!MapHelper@{\-Map\-Helper}}
\subsubsection[{is\-Tile\-Walkable}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Map\-Helper\-::is\-Tile\-Walkable} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_a2043e6d86f96881a854c33feb481bca9}


\-Definition at line 198 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar.


\begin{DoxyCode}
{
        for(int nx = x * 4; nx < x * 4 + 4; ++nx)
        {
                for(int ny = y * 4; ny < y * 4 + 4; ++ny)
                {
                        if(!BWAPI::Broodwar->isWalkable(nx, ny))
                                return false;
                }
        }

        return true;
}
\end{DoxyCode}
\hypertarget{namespaceMapHelper_adebbc5bfe75b49e11a2d4a789c865c00}{\index{\-Map\-Helper@{\-Map\-Helper}!map\-Is@{map\-Is}}
\index{map\-Is@{map\-Is}!MapHelper@{\-Map\-Helper}}
\subsubsection[{map\-Is}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Map\-Helper\-::map\-Is} (
\begin{DoxyParamCaption}
\item[{std\-::string}]{name}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_adebbc5bfe75b49e11a2d4a789c865c00}


\-Definition at line 212 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Game\-::map\-File\-Name(), and \-B\-W\-A\-P\-I\-::\-Game\-::map\-Name().



\-Referenced by \-Wall\-Tracker\-Class\-::on\-Begin(), and \-Condition\-::passes\-Value().


\begin{DoxyCode}
{
        std::string mapName = BWAPI::Broodwar->mapName();
        std::transform(mapName.begin(), mapName.end(), mapName.begin(), tolower
      );

        std::string mapFileName = BWAPI::Broodwar->mapFileName();
        std::transform(mapFileName.begin(), mapFileName.end(), mapFileName.
      begin(), tolower);

        std::transform(name.begin(), name.end(), name.begin(), tolower);

        return std::tr1::regex_search(mapName.begin(), mapName.end(), 
      std::tr1::regex(name)) || std::tr1::regex_search(mapFileName.begin(), mapFileName.end(), 
      std::tr1::regex(name));
}
\end{DoxyCode}


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




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


\hypertarget{namespaceMapHelper_aa6fd14893a4f26dcb56929717ff84621}{\index{\-Map\-Helper@{\-Map\-Helper}!spiral\-Search@{spiral\-Search}}
\index{spiral\-Search@{spiral\-Search}!MapHelper@{\-Map\-Helper}}
\subsubsection[{spiral\-Search}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Tile\-Position} {\bf \-Map\-Helper\-::spiral\-Search} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{start\-Location, }
\item[{std\-::tr1\-::function$<$ bool({\bf \-Tile\-Position})$>$}]{test\-Function, }
\item[{int}]{max\-Radius = {\ttfamily 0}}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_aa6fd14893a4f26dcb56929717ff84621}


\-Definition at line 10 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Tile\-Positions\-::\-None, \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by \-Terrain\-Anaysis\-Class\-::create\-Bases(), \-Terrain\-Anaysis\-Class\-::finalise\-Connectivity(), and \-Building\-Placer\-Class\-::get\-Build\-Location().


\begin{DoxyCode}
{
        int x = startLocation.x();
        int y = startLocation.y();

        int length = 1;
        int j      = 0;
        bool first = true;
        int dx     = 0;
        int dy     = 1;

        if(maxRadius == 0)
                maxRadius = std::max(BWAPI::Broodwar->mapWidth(), 
      BWAPI::Broodwar->mapHeight());

        while(length < maxRadius)
        {
                if(x >= 0 && x < BWAPI::Broodwar->mapWidth() && y >= 0 && y <
       BWAPI::Broodwar->mapHeight())
                {
                        TilePosition location(x, y);
                        if(testFunction(location))
                                return location;
                }

                x = x + dx;
                y = y + dy;

                //count how many steps we take in this direction
                ++j;
                if(j == length) //if we've reached the end, its time to turn
                {
                        //reset step counter
                        j = 0;

                        //Spiral out. Keep going.
                        if(!first)
                                ++length; //increment step counter if needed

                        //first=true for every other turn so we spiral out at
       the right rate
                        first = !first;

                        //turn counter clockwise 90 degrees:
                        if (dx == 0)
                        {
                                dx = dy;
                                dy = 0;
                        }
                        else
                        {
                                dy = -dx;
                                dx = 0;
                        }
                }
                //Spiral out. Keep going.
        }

        return BWAPI::TilePositions::None;
}
\end{DoxyCode}


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




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


\hypertarget{namespaceMapHelper_acb26af45e73545e02b22a3e650b3bd28}{\index{\-Map\-Helper@{\-Map\-Helper}!walk\-Search@{walk\-Search}}
\index{walk\-Search@{walk\-Search}!MapHelper@{\-Map\-Helper}}
\subsubsection[{walk\-Search}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<$ {\bf \-Walk\-Position}, int $>$ {\bf \-Map\-Helper\-::walk\-Search} (
\begin{DoxyParamCaption}
\item[{{\bf \-Walk\-Position}}]{start, }
\item[{std\-::tr1\-::function$<$ bool({\bf \-Walk\-Position})$>$}]{test\-Function, }
\item[{std\-::set$<$ {\bf \-Walk\-Position} $>$}]{targets = {\ttfamily std\-:\-:set$<${\bf \-Walk\-Position}$>$()}, }
\item[{std\-::set$<$ {\bf \-Walk\-Position} $>$}]{ignore\-Tiles = {\ttfamily std\-:\-:set$<${\bf \-Walk\-Position}$>$()}}
\end{DoxyParamCaption}
)}}\label{namespaceMapHelper_acb26af45e73545e02b22a3e650b3bd28}


\-Definition at line 109 of file \-Map\-Helper.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-Heap$<$ Key, Val $>$\-::empty(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Height(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Width(), \-Heap$<$ Key, Val $>$\-::pop(), \-Heap$<$ Key, Val $>$\-::push(), \-Heap$<$ Key, Val $>$\-::set(), \-Heap$<$ Key, Val $>$\-::top(), \-Walk\-Position\-::x, and \-Walk\-Position\-::y.


\begin{DoxyCode}
{
        std::map<WalkPosition, int> returnDistances;

        int mapWidth = BWAPI::Broodwar->mapWidth() * 4;
        int mapHeight = BWAPI::Broodwar->mapHeight() * 4;

        Heap<WalkPosition, int> openTiles(true);
        std::map<WalkPosition, int> gmap;
        std::set<WalkPosition> closedTiles;

        openTiles.push(std::make_pair(start, 0));
        gmap[start] = 0;

        int maxhvalue = std::max(mapHeight, mapWidth);

        while(!openTiles.empty())
        {
                WalkPosition p = openTiles.top().first;

                int fvalue = openTiles.top().second;
                int gvalue = gmap[p];

                openTiles.pop();
                closedTiles.insert(p);
                returnDistances[p] = gvalue;

                for(int i = 0; i < 4; ++i)
                {
                        int x = i == 0 ? 1 : i == 1 ? -1 : 0;
                        int y = i == 2 ? 1 : i == 3 ? -1 : 0;
                        WalkPosition tile(p.x + x, p.y + y);

                        if(tile.x < 0 || tile.y < 0 || tile.x >= mapWidth || 
      tile.y >= mapHeight)
                                continue;

                        if(closedTiles.find(tile) != closedTiles.end())
                                continue;

                        if(!testFunction(tile))
                                continue;

                        int g = gvalue + 1;

                        int f = g;
                        if(gmap.find(tile) == gmap.end() || gmap[tile] > g)
                        {
                                gmap[tile] = g;
                                openTiles.set(tile, f);
                        }
                }
        }

        return returnDistances;
}
\end{DoxyCode}


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


