\hypertarget{classTerrainAnaysisClass}{\section{\-Terrain\-Anaysis\-Class \-Class \-Reference}
\label{classTerrainAnaysisClass}\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}}
}


{\ttfamily \#include $<$\-Terrain\-Anaysis.\-h$>$}



\-Collaboration diagram for \-Terrain\-Anaysis\-Class\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classTerrainAnaysisClass__coll__graph}
\end{center}
\end{figure}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classTerrainAnaysisClass_a3dbd75b211df334acd5c19940b6d7d74}{\-Terrain\-Anaysis\-Class} ()
\item 
void \hyperlink{classTerrainAnaysisClass_a5546935436b00881fa758f50e2f2fb00}{analyse\-Bases\-And\-Terrain} ()
\item 
void \hyperlink{classTerrainAnaysisClass_a7900c53cde82bf687f9bbe341f37388f}{finalise\-Connectivity} ()
\item 
const std\-::set$<$ \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} $>$ \& \hyperlink{classTerrainAnaysisClass_a034bd5be724e893618fe9c4c13a315dc}{get\-Regions} () const 
\item 
const std\-::set$<$ \hyperlink{Chokepoint_8h_a865bdcf45811a239597170e10efc411f}{\-Chokepoint} $>$ \& \hyperlink{classTerrainAnaysisClass_a44ab18f43cc0e6224bc1da59d0375755}{get\-Chokepoints} () const 
\item 
const \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} \& \hyperlink{classTerrainAnaysisClass_aa199ed325958ebea96abef7b8a122f0a}{get\-Region} (\hyperlink{Interface_8h_ad2186bdc15b990e538451931b3e11c67}{\-Tile\-Position} tile) const 
\item 
const \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} \& \hyperlink{classTerrainAnaysisClass_a989a1b7a3562956d322cc9ce8bcde6f8}{get\-Region} (\hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} pos) const 
\item 
const \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} \& \hyperlink{classTerrainAnaysisClass_aa0fb16423b98787f2bee892a07962e34}{get\-Region} (\hyperlink{classWalkPosition}{\-Walk\-Position} tile) const 
\item 
const \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} \& \hyperlink{classTerrainAnaysisClass_aa503dd0579e418bfbdc9f0bba74936b0}{get\-Region} (int x, int y) const 
\item 
int \hyperlink{classTerrainAnaysisClass_abf9c7c246d1a4c6129c8fbbee005ffa0}{get\-Walk\-Clearance} (\hyperlink{classWalkPosition}{\-Walk\-Position} current\-Tile)
\item 
int \hyperlink{classTerrainAnaysisClass_a5d9ea3eae81062817b8e70e8424cda06}{get\-Walk\-Clearance} (int x, int y)
\item 
int \hyperlink{classTerrainAnaysisClass_a4998939f504db835ffd1dc2a10812509}{get\-Walk\-Connectivity} (\hyperlink{classWalkPosition}{\-Walk\-Position} current\-Tile)
\item 
int \hyperlink{classTerrainAnaysisClass_acf1e15768add60787126c6c8cf22ff70}{get\-Walk\-Connectivity} (int x, int y)
\end{DoxyCompactItemize}
\subsection*{\-Private \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classTerrainAnaysisClass_aaf6dbb0424e2b787d225148dc86c7309}{calculate\-Connectivity} ()
\item 
void \hyperlink{classTerrainAnaysisClass_a80368e39e89c9e3ba88027436d7add25}{calculate\-Walk\-Tile\-Clearance} ()
\item 
void \hyperlink{classTerrainAnaysisClass_a8b089f3d88ea450d1c378f35aa013833}{create\-Regions} ()
\item 
void \hyperlink{classTerrainAnaysisClass_af6671d1d9820bdba9412c7ff142ea65d}{create\-Bases} ()
\item 
std\-::pair$<$ \hyperlink{classWalkPosition}{\-Walk\-Position}, \*
\hyperlink{classWalkPosition}{\-Walk\-Position} $>$ \hyperlink{classTerrainAnaysisClass_ae3c6b723e5f6317043e0624acebed7a8}{find\-Choke\-Point} (\hyperlink{classWalkPosition}{\-Walk\-Position} center)
\item 
void \hyperlink{classTerrainAnaysisClass_a72cb31fb65e79b613056559e1b58cb3f}{remove\-Chokepoint} (\hyperlink{Chokepoint_8h_a865bdcf45811a239597170e10efc411f}{\-Chokepoint} choke\-To\-Remove)
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
std\-::set$<$ \hyperlink{Chokepoint_8h_a865bdcf45811a239597170e10efc411f}{\-Chokepoint} $>$ \hyperlink{classTerrainAnaysisClass_a81fed7acd119a0ebc42049c86a9b8a90}{m\-Chokepoints}
\item 
std\-::set$<$ \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} $>$ \hyperlink{classTerrainAnaysisClass_a65e3e67878d8ab5b52f36e0b7094c41d}{m\-Regions}
\item 
\hyperlink{classRectangleArray}{\-Rectangle\-Array}$<$ \hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} $>$ \hyperlink{classTerrainAnaysisClass_ab1ea66a6f586a89fe387bfe04e7052b0}{m\-Tile\-To\-Region}
\item 
\hyperlink{classRectangleArray}{\-Rectangle\-Array}$<$ int $>$ \hyperlink{classTerrainAnaysisClass_a27dfba6799119df0ad90a29872bbf544}{m\-Tile\-Connectivity}
\item 
std\-::set$<$ int $>$ \hyperlink{classTerrainAnaysisClass_a05bcb804882316dcb4426ebe4fb89735}{m\-Small\-Obstacles}
\item 
\hyperlink{classRectangleArray}{\-Rectangle\-Array}$<$ int $>$ \hyperlink{classTerrainAnaysisClass_aef0daf221be0ea05c17646df4c9b25b7}{m\-Tile\-Clearance}
\item 
\hyperlink{classRectangleArray}{\-Rectangle\-Array}$<$ \hyperlink{classWalkPosition}{\-Walk\-Position} $>$ \hyperlink{classTerrainAnaysisClass_a61e34fd4a1e18f91396660f0a2fcaa98}{m\-Tile\-Closest\-Obstacle}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 10 of file \-Terrain\-Anaysis.\-h.



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


\-Definition at line 15 of file \-Terrain\-Anaysis.\-cpp.


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


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classTerrainAnaysisClass_a5546935436b00881fa758f50e2f2fb00}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!analyse\-Bases\-And\-Terrain@{analyse\-Bases\-And\-Terrain}}
\index{analyse\-Bases\-And\-Terrain@{analyse\-Bases\-And\-Terrain}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{analyse\-Bases\-And\-Terrain}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::analyse\-Bases\-And\-Terrain} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classTerrainAnaysisClass_a5546935436b00881fa758f50e2f2fb00}


\-Definition at line 19 of file \-Terrain\-Anaysis.\-cpp.



\-References calculate\-Connectivity(), calculate\-Walk\-Tile\-Clearance(), create\-Bases(), create\-Regions(), finalise\-Connectivity(), and \-Singleton$<$ T $>$\-::\-Instance().


\begin{DoxyCode}
{
        calculateConnectivity();
        calculateWalkTileClearance();
        createRegions();

        createBases();

        BuildingPlacer::Instance().calculateReservations();
        finaliseConnectivity();
        BuildingPlacer::Instance().finaliseReservations();
}
\end{DoxyCode}


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


\hypertarget{classTerrainAnaysisClass_aaf6dbb0424e2b787d225148dc86c7309}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!calculate\-Connectivity@{calculate\-Connectivity}}
\index{calculate\-Connectivity@{calculate\-Connectivity}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{calculate\-Connectivity}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::calculate\-Connectivity} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_aaf6dbb0424e2b787d225148dc86c7309}


\-Definition at line 237 of file \-Terrain\-Anaysis.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Game\-::is\-Walkable(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Height(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Width(), m\-Small\-Obstacles, m\-Tile\-Connectivity, and \-Rectangle\-Array$<$ T $>$\-::resize().



\-Referenced by analyse\-Bases\-And\-Terrain().


\begin{DoxyCode}
{
        int mapWidth = BWAPI::Broodwar->mapWidth() * 4;
        int mapHeight = BWAPI::Broodwar->mapHeight() * 4;

        int currentRegion = 1;
        mTileConnectivity.resize(mapWidth, mapHeight, 0);
        for(int x = 0; x < mapWidth; ++x)
        {
                for(int y = 0; y < mapHeight; ++y)
                {
                        if(mTileConnectivity[x][y] != 0)
                                continue;

                        bool walkable = BWAPI::Broodwar->isWalkable(x, y);
                        int tileCount = 0;

                        std::set<WalkPosition> unvisitedTiles;
                        unvisitedTiles.insert(WalkPosition(x, y));

                        while(!unvisitedTiles.empty())
                        {
                                const std::set<WalkPosition>::iterator &tile = 
      unvisitedTiles.begin();

                                ++tileCount;
                                mTileConnectivity[tile->x][tile->y] = 
      currentRegion;

                                if(tile->x > 0 && BWAPI::Broodwar->isWalkable(
      tile->x-1, tile->y) == walkable && mTileConnectivity[tile->x-1][tile->y] == 0)
                                        unvisitedTiles.insert(WalkPosition(tile
      ->x-1, tile->y));
                                if(tile->y > 0 && BWAPI::Broodwar->isWalkable(
      tile->x, tile->y-1) == walkable && mTileConnectivity[tile->x][tile->y-1] == 0)
                                        unvisitedTiles.insert(WalkPosition(tile
      ->x, tile->y-1));

                                if(tile->x < mapWidth-1 && BWAPI::Broodwar->
      isWalkable(tile->x+1, tile->y) == walkable && mTileConnectivity[tile->x+1][tile
      ->y] == 0)
                                        unvisitedTiles.insert(WalkPosition(tile
      ->x+1, tile->y));
                                if(tile->y < mapHeight-1 && BWAPI::Broodwar->
      isWalkable(tile->x, tile->y+1) == walkable && mTileConnectivity[tile->x][tile->
      y+1] == 0)
                                        unvisitedTiles.insert(WalkPosition(tile
      ->x, tile->y+1));

                                unvisitedTiles.erase(tile);
                        }

                        if(!walkable && tileCount < 200)
                                mSmallObstacles.insert(currentRegion);

                        ++currentRegion;
                }
        }
}
\end{DoxyCode}


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




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


\hypertarget{classTerrainAnaysisClass_a80368e39e89c9e3ba88027436d7add25}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!calculate\-Walk\-Tile\-Clearance@{calculate\-Walk\-Tile\-Clearance}}
\index{calculate\-Walk\-Tile\-Clearance@{calculate\-Walk\-Tile\-Clearance}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{calculate\-Walk\-Tile\-Clearance}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::calculate\-Walk\-Tile\-Clearance} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a80368e39e89c9e3ba88027436d7add25}


\-Definition at line 72 of file \-Terrain\-Anaysis.\-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(), m\-Small\-Obstacles, m\-Tile\-Clearance, m\-Tile\-Closest\-Obstacle, m\-Tile\-Connectivity, \-Heap$<$ Key, Val $>$\-::pop(), \-Rectangle\-Array$<$ T $>$\-::resize(), \-Heap$<$ Key, Val $>$\-::set(), \-Heap$<$ Key, Val $>$\-::top(), \-Walk\-Position\-::x, and \-Walk\-Position\-::y.



\-Referenced by analyse\-Bases\-And\-Terrain().


\begin{DoxyCode}
{
        int mapWidth = BWAPI::Broodwar->mapWidth() * 4;
        int mapHeight = BWAPI::Broodwar->mapHeight() * 4;

        mTileClearance.resize(mapWidth, mapHeight, -1);
        mTileClosestObstacle.resize(mapWidth, mapHeight);

        Heap<WalkPosition, int> unvisitedTiles(true);
        for(int x = 0; x < mapWidth; ++x)
        {
                for(int y = 0; y < mapHeight; ++y)
                {
                        if(!BWAPI::Broodwar->isWalkable(x, y))
                        {
                                mTileClearance[x][y] = 0;
                                mTileClosestObstacle[x][y] = WalkPosition(x, y)
      ;
                                if(mSmallObstacles.count(mTileConnectivity[x][y
      ]) == 0)
                                        unvisitedTiles.set(WalkPosition(x, y), 
      0);
                        }
                        else if(x == 0 || y == 0 || x == mapWidth-1 || y == 
      mapHeight-1)
                        {
                                mTileClearance[x][y] = 10;
                                mTileClosestObstacle[x][y] = WalkPosition((x ==
       0 ? -1 : (x == mapWidth-1 ? mapWidth : x)), (y == 0 ? -1 : (y == mapHeight-1 ? 
      mapHeight : y)));
                                unvisitedTiles.set(WalkPosition(x, y), 10);
                        }
                }
        }

        while(!unvisitedTiles.empty())
        {
                WalkPosition tile = unvisitedTiles.top().first;
                const int distance = unvisitedTiles.top().second + 10;
                const int diagDistance = distance + 4;
                unvisitedTiles.pop();

                const int west = tile.x - 1;
                const int north = tile.y - 1;
                const int east = tile.x + 1;
                const int south = tile.y + 1;

                const bool canGoWest = west >= 0;
                const bool canGoNorth = north >= 0;
                const bool canGoEast = east < mapWidth;
                const bool canGoSouth = south < mapHeight;

                const WalkPosition &currentParent = mTileClosestObstacle[tile.x
      ][tile.y];

                if(canGoWest && (mTileClearance[west][tile.y] == -1 || distance
       < mTileClearance[west][tile.y]))
                {
                        mTileClearance[west][tile.y] = distance;
                        mTileClosestObstacle[west][tile.y] = currentParent;
                        unvisitedTiles.set(WalkPosition(west, tile.y), distance
      );
                }

                if(canGoNorth && (mTileClearance[tile.x][north] == -1 || 
      distance < mTileClearance[tile.x][north]))
                {
                        mTileClearance[tile.x][north] = distance;
                        mTileClosestObstacle[tile.x][north] = currentParent;
                        unvisitedTiles.set(WalkPosition(tile.x, north), 
      distance);
                }

                if(canGoEast && (mTileClearance[east][tile.y] == -1 || distance
       < mTileClearance[east][tile.y]))
                {
                        mTileClearance[east][tile.y] = distance;
                        mTileClosestObstacle[east][tile.y] = currentParent;
                        unvisitedTiles.set(WalkPosition(east, tile.y), distance
      );
                }

                if(canGoSouth && (mTileClearance[tile.x][south] == -1 || 
      distance < mTileClearance[tile.x][south]))
                {
                        mTileClearance[tile.x][south] = distance;
                        mTileClosestObstacle[tile.x][south] = currentParent;
                        unvisitedTiles.set(WalkPosition(tile.x, south), 
      distance);
                }

                if(canGoWest && canGoNorth && (mTileClearance[west][north] == -
      1 || diagDistance < mTileClearance[west][north]))
                {
                        mTileClearance[west][north] = diagDistance;
                        mTileClosestObstacle[west][north] = currentParent;
                        unvisitedTiles.set(WalkPosition(west, north), 
      diagDistance);
                }

                if(canGoEast && canGoSouth && (mTileClearance[east][south] == -
      1 || diagDistance < mTileClearance[east][south]))
                {
                        mTileClearance[east][south] = diagDistance;
                        mTileClosestObstacle[east][south] = currentParent;
                        unvisitedTiles.set(WalkPosition(east, south), 
      diagDistance);
                }

                if(canGoEast && canGoNorth && (mTileClearance[east][north] == -
      1 || diagDistance < mTileClearance[east][north]))
                {
                        mTileClearance[east][north] = diagDistance;
                        mTileClosestObstacle[east][north] = currentParent;
                        unvisitedTiles.set(WalkPosition(east, north), 
      diagDistance);
                }

                if(canGoWest && canGoSouth && (mTileClearance[west][south] == -
      1 || diagDistance < mTileClearance[west][south]))
                {
                        mTileClearance[west][south] = diagDistance;
                        mTileClosestObstacle[west][south] = currentParent;
                        unvisitedTiles.set(WalkPosition(west, south), 
      diagDistance);
                }
        }
}
\end{DoxyCode}


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




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


\hypertarget{classTerrainAnaysisClass_af6671d1d9820bdba9412c7ff142ea65d}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!create\-Bases@{create\-Bases}}
\index{create\-Bases@{create\-Bases}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{create\-Bases}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::create\-Bases} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_af6671d1d9820bdba9412c7ff142ea65d}


\-Definition at line 594 of file \-Terrain\-Anaysis.\-cpp.



\-References \-Unit\-Group\-::begin(), \-B\-W\-A\-P\-I\-::\-Broodwar, \-Unit\-Group\-::end(), \-B\-W\-A\-P\-I\-::\-Position\-::get\-Approx\-Distance(), \-Unit\-Group\-::get\-Center(), \-Unit\-Helper\-::get\-Clusters(), \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Height(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Width(), m\-Regions, m\-Tile\-To\-Region, \-Map\-Helper\-::spiral\-Search(), \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::x(), and \-B\-W\-A\-P\-I\-::\-Tile\-Position\-::y().



\-Referenced by analyse\-Bases\-And\-Terrain().


\begin{DoxyCode}
{
        //Create a set of all Geysers and all mineral patches with more than
       200 minerals
        UnitGroup resources = UnitTracker::Instance().getGeysers();
        for each(Unit mineral in UnitTracker::Instance().getMinerals())
        {
                if(mineral->getResources() > 200)
                        resources.insert(mineral);
        }

        //Group them into clusters
        std::vector<UnitGroup> resourceClusters = UnitHelper::getClusters(
      resources, 260, 3);

        //TODO: create the bases on the fly rather then collect information
       then create
        std::set<TilePosition> basesToCreate;
        std::map<TilePosition, UnitGroup> baseToCreateToMineral;
        std::map<TilePosition, bool> baseIsRegionBase;
        std::map<TilePosition, bool> baseToCreateIsStartLocation;
        std::map<TilePosition, Region> baseToRegion;
        std::map<Region, std::set<TilePosition>> baseToCreateFromRegion;

        for each(UnitGroup resourceCluster in resourceClusters)
        {
                TilePosition baseLocation;
                PossibleLocationCompare locationCompare(&resourceCluster, &
      baseLocation);
                MapHelper::spiralSearch(TilePosition(resourceCluster.getCenter(
      )), locationCompare, 18);

                bool addedToOther = false;
                for(std::map<TilePosition, UnitGroup>::iterator it = 
      baseToCreateToMineral.begin(); it != baseToCreateToMineral.end(); ++it)
                {
                        int dx = abs(baseLocation.x() - it->first.x());
                        int dy = abs(baseLocation.y() - it->first.y());

                        if(dx <= 4 && dy <= 3)
                        {
                                it->second.insert(resourceCluster.begin(), 
      resourceCluster.end());
                                addedToOther = true;
                                break;
                        }
                }

                if(!addedToOther)
                {
                        basesToCreate.insert(baseLocation);
                        baseToCreateToMineral[baseLocation] = resourceCluster;
                }
        }

        for each(TilePosition base in basesToCreate)
        {
                Region region = mTileToRegion[base.x() * 4][base.y() * 4];
                if(region)
                {
                        baseToCreateFromRegion[region].insert(base);
                        baseToRegion[base] = region;
                }
        }

        RectangleArray<TilePosition> tileToBase(BWAPI::Broodwar->mapWidth(), 
      BWAPI::Broodwar->mapHeight());
        std::map<TilePosition, std::set<TilePosition>> baseToTiles;

        for(int x = 0; x < BWAPI::Broodwar->mapWidth(); ++x)
        {
                for(int y = 0; y < BWAPI::Broodwar->mapHeight(); ++y)
                {
                        Region region = mTileToRegion[x*4][y*4];

                        //This isn't a region, so find the closest Region
                        if(!region || region->getClearance() < 80)
                        {
                                int distance = std::numeric_limits<int>::max();
                                for each(Region reg in mRegions)
                                {
                                        if(reg->getClearance() < 80)
                                                continue;

                                        int thisDistance = reg->getCenter().
      getApproxDistance(Position(x*32, y*32));
                                        if(thisDistance < distance)
                                        {
                                                distance = thisDistance;
                                                region = reg;
                                        }
                                }
                        }

                        // Still hasn't got a region? something must be wrong
       with the analysis
                        if(!region)
                                return;
                        
                        // Dont already have a base for this region
                        if(baseToCreateFromRegion.count(region) == 0)
                        {
                                TilePosition newBase = TilePosition(region->
      getCenter());

                                basesToCreate.insert(newBase);
                                baseToCreateFromRegion[region].insert(newBase);
                                baseToRegion[newBase] = region;

                                tileToBase[x][y] = newBase;
                                baseToTiles[newBase].insert(TilePosition(x, y))
      ;
                                baseIsRegionBase[newBase] = true;
                        }
                        // Have 1 base exactly, use it
                        else if(baseToCreateFromRegion[region].size() == 1)
                        {
                                TilePosition base = *baseToCreateFromRegion[
      region].begin();
                                tileToBase[x][y] = base;
                                baseToTiles[base].insert(TilePosition(x, y));
                        }
                        // Find the closest from the possibilities
                        else
                        {
                                TilePosition baseToUse;
                                int distance = std::numeric_limits<int>::max();

                                for each(TilePosition base in 
      baseToCreateFromRegion[region])
                                {
                                        int thisDistance = Position(base).
      getApproxDistance(Position(x*32, y*32));
                                        if(thisDistance < distance)
                                        {
                                                distance = thisDistance;
                                                baseToUse = base;
                                        }
                                }

                                tileToBase[x][y] = baseToUse;
                                baseToTiles[baseToUse].insert(TilePosition(x, y
      ));
                        }
                }
        }

        for each(TilePosition startLocation in BWAPI::Broodwar->
      getStartLocations())
        {
                baseToCreateIsStartLocation[tileToBase[startLocation.x()][
      startLocation.y()]] = true;
        }

        for each(TilePosition base in basesToCreate)
        {
                Base newBase;
                if(baseIsRegionBase[base])
                        newBase = BaseTracker::Instance().createBase(
      baseToTiles[base], baseToRegion[base], baseToCreateIsStartLocation[base]);
                else
                        newBase = BaseTracker::Instance().createBase(
      baseToTiles[base], baseToRegion[base], baseToCreateIsStartLocation[base], base, 
      baseToCreateToMineral[base]);

                newBase->getRegion()->addBase(newBase);
        }
}
\end{DoxyCode}


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




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


\hypertarget{classTerrainAnaysisClass_a8b089f3d88ea450d1c378f35aa013833}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!create\-Regions@{create\-Regions}}
\index{create\-Regions@{create\-Regions}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{create\-Regions}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::create\-Regions} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a8b089f3d88ea450d1c378f35aa013833}


\-Definition at line 285 of file \-Terrain\-Anaysis.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-Heap$<$ Key, Val $>$\-::empty(), \-Heap$<$ Key, Val $>$\-::erase(), find\-Choke\-Point(), \-Walk\-Position\-::get\-Center\-Position(), get\-Regions(), \-Singleton$<$ T $>$\-::\-Instance(), \-L\-O\-G\-M\-E\-S\-S\-A\-G\-E\-W\-A\-R\-N\-I\-N\-G, \-B\-W\-A\-P\-I\-::\-Coordinate\-Type\-::\-Map, \-B\-W\-A\-P\-I\-::\-Game\-::map\-Height(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Width(), m\-Chokepoints, m\-Regions, m\-Tile\-Clearance, m\-Tile\-To\-Region, \-Heap$<$ Key, Val $>$\-::pop(), \-B\-W\-A\-P\-I\-::\-Colors\-::\-Red, remove\-Chokepoint(), \-Rectangle\-Array$<$ T $>$\-::resize(), \-Heap$<$ Key, Val $>$\-::set(), \-Heap$<$ Key, Val $>$\-::top(), \-Walk\-Position\-::x, and \-Walk\-Position\-::y.



\-Referenced by analyse\-Bases\-And\-Terrain().


\begin{DoxyCode}
{
        int mapWidth = BWAPI::Broodwar->mapWidth() * 4;
        int mapHeight = BWAPI::Broodwar->mapHeight() * 4;

        // This comment is self explanatory.
        mTileToRegion.resize(mapWidth, mapHeight);
        std::map<WalkPosition, Chokepoint> chokeTiles;

        for(;;)
        {
                int currentRegionClearance = 0;
                WalkPosition currentRegionTile;

                for(int x = 0; x < mapWidth; ++x)
                {
                        for(int y = 0; y < mapHeight; ++y)
                        {
                                if(mTileToRegion[x][y])
                                        continue;

                                if(chokeTiles.count(WalkPosition(x, y)) != 0)
                                        continue;

                                const int localMaximaValue = mTileClearance[x][
      y];
                                if(localMaximaValue > currentRegionClearance)
                                {
                                        currentRegionClearance = 
      localMaximaValue;
                                        currentRegionTile.x = x;
                                        currentRegionTile.y = y;
                                }
                        }
                }

                if(currentRegionClearance == 0)
                        break;

                Region currentRegion(new RegionClass(currentRegionTile.
      getCenterPosition(), currentRegionClearance));
                mRegions.insert(currentRegion);

                std::map<WalkPosition, WalkPosition> tileToLastMinima;
                std::map<WalkPosition, std::vector<WalkPosition>> 
      tileToChildren;

                Heap<WalkPosition, int> unvisitedTiles(false);

                unvisitedTiles.set(currentRegionTile, currentRegionClearance);
                tileToLastMinima[currentRegionTile] = currentRegionTile;

                while(!unvisitedTiles.empty())
                {
                        WalkPosition currentTile = unvisitedTiles.top().first;
                        int currentTileClearance = unvisitedTiles.top().second;
                        unvisitedTiles.pop();

                        if(chokeTiles.count(currentTile) != 0)
                        {
                                if(chokeTiles[currentTile]->getRegions().second
       && chokeTiles[currentTile]->getRegions().second != currentRegion)
                                {
                                        DrawBuffer::Instance().drawBufferedBox(
      BWAPI::CoordinateType::Map, currentTile.x * 8, currentTile.y * 8, currentTile.x
       * 8 + 8, currentTile.y * 8 + 8, 999999, BWAPI::Colors::Red);
                                        LOGMESSAGEWARNING("Touched a choke
       saved to anouther region");
                                }
                                else if(chokeTiles[currentTile]->getRegions().
      first != currentRegion)
                                {
                                        currentRegion->addChokepoint(chokeTiles
      [currentTile]);
                                        chokeTiles[currentTile]->setRegion2(
      currentRegion);
                                }

                                continue;
                        }

                        if(mTileToRegion[currentTile.x][currentTile.y])
                        {
                                LOGMESSAGEWARNING("2 regions possibly connected
       without a choke");
                                continue;
                        }

                        WalkPosition lastMinima = tileToLastMinima[currentTile]
      ;
                        const int chokeSize = mTileClearance[lastMinima.x][
      lastMinima.y];

                        bool foundChokepoint = false;
                        if(chokeSize < int(float(currentRegionClearance)*0.90f)
       && chokeSize < int(float(currentTileClearance)*0.80f))
                                foundChokepoint = true;

                        if(foundChokepoint)
                        {
                                const int minDistance = 32;
                                if((abs(currentRegionTile.x - lastMinima.x) + 
      abs(currentRegionTile.y - lastMinima.y)) < minDistance)
                                        foundChokepoint = false;
                                else if((abs(currentTile.x - lastMinima.x) + 
      abs(currentTile.y - lastMinima.y)) < minDistance)
                                        foundChokepoint = false;
                                else if(currentTileClearance < 120)
                                        foundChokepoint = false;
                        }

                        if(foundChokepoint)
                        {
                                const std::pair<WalkPosition, WalkPosition> &
      chokeSides = findChokePoint(lastMinima);

                                Chokepoint currentChokepoint(new ChokepointClass
      (chokeSides.first.getCenterPosition(), chokeSides.second.getCenterPosition(), 
      chokeSize));
                                mChokepoints.insert(currentChokepoint);

                                currentChokepoint->setRegion1(currentRegion);
                                currentRegion->addChokepoint(currentChokepoint)
      ;

                                int x0 = chokeSides.second.x;
                                int y0 = chokeSides.second.y;

                                int x1 = chokeSides.first.x;
                                int y1 = chokeSides.first.y;

                                int dx = abs(x1 - x0);
                                int dy = abs(y1 - y0);

                                int sx = x0 < x1 ? 1 : -1;
                                int sy = y0 < y1 ? 1 : -1;

                                int error = dx - dy;

                                std::set<WalkPosition> chokeChildren;

                                for(;;)
                                {
                                        if(x0 >= 0 && y0 >= 0 && x0 < mapWidth 
      && y0 < mapHeight && mTileClearance[x0][y0] != 0 && !mTileToRegion[x0][y0])
                                        {
                                                const WalkPosition 
      thisChokeTile(x0, y0);

                                                tileToChildren[
      currentRegionTile].push_back(thisChokeTile);
                                                chokeTiles[thisChokeTile] = 
      currentChokepoint;
                                                chokeChildren.insert(
      thisChokeTile);
                                        }

                                        if(x0 == x1 && y0 == y1)
                                                break;

                                        int e2 = error*2;
                                        if(e2 > -dy)
                                        {
                                                error -= dy;
                                                x0 += sx;
                                        }
                                        if(e2 < dx)
                                        {
                                                error += dx;
                                                y0 += sy;
                                        }
                                }

                                while(!chokeChildren.empty())
                                {
                                        std::set<WalkPosition>::iterator 
      currentTile = chokeChildren.begin();

                                        tileToLastMinima.erase(*currentTile);
                                        unvisitedTiles.erase(*currentTile);

                                        for each(WalkPosition nextTile in 
      tileToChildren[*currentTile])
                                        {
                                                chokeChildren.insert(nextTile);
                                        }
                                        tileToChildren.erase(*currentTile);

                                        chokeChildren.erase(currentTile);
                                }
                        }
                        else
                        {
                                if(mTileClearance[currentTile.x][currentTile.y]
       < chokeSize)
                                        lastMinima = currentTile;

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

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

                                        if(mTileClearance[x][y] == 0)
                                                continue;

                                        const WalkPosition nextTile(x, y);
                                        if(tileToLastMinima.count(nextTile) == 
      0)
                                        {
                                                tileToLastMinima[nextTile] = 
      lastMinima;
                                                tileToChildren[currentTile].
      push_back(nextTile);

                                                unvisitedTiles.set(nextTile, 
      mTileClearance[x][y]);
                                        }
                                }
                        }
                }

                std::set<WalkPosition> tileSteps;
                tileSteps.insert(currentRegionTile);
                int regionSize = 1;

                while(!tileSteps.empty())
                {
                        std::set<WalkPosition>::iterator currentTile = 
      tileSteps.begin();
                        ++regionSize;

                        for each(WalkPosition nextTile in tileToChildren[*
      currentTile])
                        {
                                tileSteps.insert(nextTile);
                        }

                        mTileToRegion[currentTile->x][currentTile->y] = 
      currentRegion;

                        tileSteps.erase(currentTile);
                }

                currentRegion->setSize(regionSize);
        }

        for(std::set<Chokepoint>::iterator it = mChokepoints.begin(); it != 
      mChokepoints.end();)
        {
                if(!(*it)->getRegions().first || !(*it)->getRegions().second ||
       (*it)->getRegions().first == (*it)->getRegions().second)
                        removeChokepoint(*(it++));
                else
                        ++it;
        }
}
\end{DoxyCode}


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




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


\hypertarget{classTerrainAnaysisClass_a7900c53cde82bf687f9bbe341f37388f}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!finalise\-Connectivity@{finalise\-Connectivity}}
\index{finalise\-Connectivity@{finalise\-Connectivity}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{finalise\-Connectivity}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::finalise\-Connectivity} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classTerrainAnaysisClass_a7900c53cde82bf687f9bbe341f37388f}


\-Definition at line 56 of file \-Terrain\-Anaysis.\-cpp.



\-References m\-Chokepoints, m\-Regions, and \-Map\-Helper\-::spiral\-Search().



\-Referenced by analyse\-Bases\-And\-Terrain().


\begin{DoxyCode}
{
        for each(Region region in mRegions)
        {
                WalkInRegionComp goCompare(region);

                for each(Chokepoint chokepoint in mChokepoints)
                {
                        TilePosition pos = MapHelper::spiralSearch(TilePosition
      (chokepoint->getCenter()), goCompare, 24);

                        region->addChokepointTile(chokepoint, pos);
                        chokepoint->addChokepointTile(region, pos);
                }
        }
}
\end{DoxyCode}


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




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


\hypertarget{classTerrainAnaysisClass_ae3c6b723e5f6317043e0624acebed7a8}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!find\-Choke\-Point@{find\-Choke\-Point}}
\index{find\-Choke\-Point@{find\-Choke\-Point}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{find\-Choke\-Point}]{\setlength{\rightskip}{0pt plus 5cm}std\-::pair$<$ {\bf \-Walk\-Position}, {\bf \-Walk\-Position} $>$ {\bf \-Terrain\-Anaysis\-Class\-::find\-Choke\-Point} (
\begin{DoxyParamCaption}
\item[{{\bf \-Walk\-Position}}]{center}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_ae3c6b723e5f6317043e0624acebed7a8}


\-Definition at line 178 of file \-Terrain\-Anaysis.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-Vector\-::dot\-Product(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Height(), \-B\-W\-A\-P\-I\-::\-Game\-::map\-Width(), m\-Tile\-Closest\-Obstacle, \-Vector\-::normalise(), \-Walk\-Position\-::x, and \-Walk\-Position\-::y.



\-Referenced by create\-Regions().


\begin{DoxyCode}
{
        WalkPosition side1 = mTileClosestObstacle[center.x][center.y];

        if(side1 == center)
                return std::make_pair(side1, side1);

        Vector side1Direction(side1.x - center.x, side1.y - center.y);
        side1Direction.normalise();

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

        int x0 = side1.x;
        int y0 = side1.y;

        int x1 = center.x;
        int y1 = center.y;

        int dx = abs(x1 - x0);
        int dy = abs(y1 - y0);

        int sx = x0 < x1 ? 1 : -1;
        int sy = y0 < y1 ? 1 : -1;

        x0 = x1;
        y0 = y1;

        int error = dx - dy;

        for(;;)
        {
                if(x0 < 0 || y0 < 0 || x0 >= mapWidth || y0 >= mapHeight || !
      BWAPI::Broodwar->isWalkable(x0, y0))
                        return std::make_pair(side1, WalkPosition(x0, y0));

                WalkPosition side2 = mTileClosestObstacle[x0][y0];

                Vector side2Direction(side2.x - center.x, side2.y - center.y);
                side2Direction.normalise();

                float dot = side2Direction.dotProduct(side1Direction);
                float angle = acos(dot);
                if(angle > 2.0f)
                        return std::make_pair(side1, side2);

                int e2 = error*2;
                if(e2 > -dy)
                {
                        error -= dy;
                        x0 += sx;
                }
                if(e2 < dx)
                {
                        error += dx;
                        y0 += sy;
                }
        }
}
\end{DoxyCode}


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




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


\hypertarget{classTerrainAnaysisClass_a44ab18f43cc0e6224bc1da59d0375755}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Chokepoints@{get\-Chokepoints}}
\index{get\-Chokepoints@{get\-Chokepoints}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Chokepoints}]{\setlength{\rightskip}{0pt plus 5cm}const std\-::set$<${\bf \-Chokepoint}$>$\& {\bf \-Terrain\-Anaysis\-Class\-::get\-Chokepoints} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_a44ab18f43cc0e6224bc1da59d0375755}


\-Definition at line 19 of file \-Terrain\-Anaysis.\-h.



\-References m\-Chokepoints.


\begin{DoxyCode}
{ return mChokepoints; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_aa199ed325958ebea96abef7b8a122f0a}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Region@{get\-Region}}
\index{get\-Region@{get\-Region}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Region}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf \-Region}\& {\bf \-Terrain\-Anaysis\-Class\-::get\-Region} (
\begin{DoxyParamCaption}
\item[{{\bf \-Tile\-Position}}]{tile}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_aa199ed325958ebea96abef7b8a122f0a}


\-Definition at line 21 of file \-Terrain\-Anaysis.\-h.



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


\begin{DoxyCode}
{ return mTileToRegion[tile.x()*4][tile.y()*4]; }
\end{DoxyCode}


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


\hypertarget{classTerrainAnaysisClass_a989a1b7a3562956d322cc9ce8bcde6f8}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Region@{get\-Region}}
\index{get\-Region@{get\-Region}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Region}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf \-Region}\& {\bf \-Terrain\-Anaysis\-Class\-::get\-Region} (
\begin{DoxyParamCaption}
\item[{{\bf \-Position}}]{pos}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_a989a1b7a3562956d322cc9ce8bcde6f8}


\-Definition at line 22 of file \-Terrain\-Anaysis.\-h.



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


\begin{DoxyCode}
{ return mTileToRegion[pos.x()/8][pos.y()/8]; }
\end{DoxyCode}


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


\hypertarget{classTerrainAnaysisClass_aa0fb16423b98787f2bee892a07962e34}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Region@{get\-Region}}
\index{get\-Region@{get\-Region}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Region}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf \-Region}\& {\bf \-Terrain\-Anaysis\-Class\-::get\-Region} (
\begin{DoxyParamCaption}
\item[{{\bf \-Walk\-Position}}]{tile}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_aa0fb16423b98787f2bee892a07962e34}


\-Definition at line 23 of file \-Terrain\-Anaysis.\-h.



\-References m\-Tile\-To\-Region, \-Walk\-Position\-::x, and \-Walk\-Position\-::y.


\begin{DoxyCode}
{ return mTileToRegion[tile.x][tile.y]; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_aa503dd0579e418bfbdc9f0bba74936b0}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Region@{get\-Region}}
\index{get\-Region@{get\-Region}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Region}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf \-Region}\& {\bf \-Terrain\-Anaysis\-Class\-::get\-Region} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_aa503dd0579e418bfbdc9f0bba74936b0}


\-Definition at line 24 of file \-Terrain\-Anaysis.\-h.



\-References m\-Tile\-To\-Region.


\begin{DoxyCode}
{ return mTileToRegion[x][y]; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_a034bd5be724e893618fe9c4c13a315dc}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Regions@{get\-Regions}}
\index{get\-Regions@{get\-Regions}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Regions}]{\setlength{\rightskip}{0pt plus 5cm}const std\-::set$<${\bf \-Region}$>$\& {\bf \-Terrain\-Anaysis\-Class\-::get\-Regions} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_a034bd5be724e893618fe9c4c13a315dc}


\-Definition at line 18 of file \-Terrain\-Anaysis.\-h.



\-References m\-Regions.



\-Referenced by create\-Regions().


\begin{DoxyCode}
{ return mRegions; }
\end{DoxyCode}


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


\hypertarget{classTerrainAnaysisClass_abf9c7c246d1a4c6129c8fbbee005ffa0}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Walk\-Clearance@{get\-Walk\-Clearance}}
\index{get\-Walk\-Clearance@{get\-Walk\-Clearance}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Walk\-Clearance}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Terrain\-Anaysis\-Class\-::get\-Walk\-Clearance} (
\begin{DoxyParamCaption}
\item[{{\bf \-Walk\-Position}}]{current\-Tile}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_abf9c7c246d1a4c6129c8fbbee005ffa0}


\-Definition at line 26 of file \-Terrain\-Anaysis.\-h.



\-References m\-Tile\-Clearance, \-Walk\-Position\-::x, and \-Walk\-Position\-::y.


\begin{DoxyCode}
{ return mTileClearance[currentTile.x][currentTile.y]; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_a5d9ea3eae81062817b8e70e8424cda06}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Walk\-Clearance@{get\-Walk\-Clearance}}
\index{get\-Walk\-Clearance@{get\-Walk\-Clearance}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Walk\-Clearance}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Terrain\-Anaysis\-Class\-::get\-Walk\-Clearance} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_a5d9ea3eae81062817b8e70e8424cda06}


\-Definition at line 27 of file \-Terrain\-Anaysis.\-h.



\-References m\-Tile\-Clearance.


\begin{DoxyCode}
{ return mTileClearance[x][y]; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_a4998939f504db835ffd1dc2a10812509}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Walk\-Connectivity@{get\-Walk\-Connectivity}}
\index{get\-Walk\-Connectivity@{get\-Walk\-Connectivity}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Walk\-Connectivity}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Terrain\-Anaysis\-Class\-::get\-Walk\-Connectivity} (
\begin{DoxyParamCaption}
\item[{{\bf \-Walk\-Position}}]{current\-Tile}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_a4998939f504db835ffd1dc2a10812509}


\-Definition at line 29 of file \-Terrain\-Anaysis.\-h.



\-References m\-Tile\-Connectivity, \-Walk\-Position\-::x, and \-Walk\-Position\-::y.


\begin{DoxyCode}
{ return mTileConnectivity[currentTile.x][currentTile.y]; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_acf1e15768add60787126c6c8cf22ff70}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!get\-Walk\-Connectivity@{get\-Walk\-Connectivity}}
\index{get\-Walk\-Connectivity@{get\-Walk\-Connectivity}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{get\-Walk\-Connectivity}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Terrain\-Anaysis\-Class\-::get\-Walk\-Connectivity} (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classTerrainAnaysisClass_acf1e15768add60787126c6c8cf22ff70}


\-Definition at line 30 of file \-Terrain\-Anaysis.\-h.



\-References m\-Tile\-Connectivity.


\begin{DoxyCode}
{ return mTileConnectivity[x][y]; }
\end{DoxyCode}
\hypertarget{classTerrainAnaysisClass_a72cb31fb65e79b613056559e1b58cb3f}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!remove\-Chokepoint@{remove\-Chokepoint}}
\index{remove\-Chokepoint@{remove\-Chokepoint}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{remove\-Chokepoint}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Terrain\-Anaysis\-Class\-::remove\-Chokepoint} (
\begin{DoxyParamCaption}
\item[{{\bf \-Chokepoint}}]{choke\-To\-Remove}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a72cb31fb65e79b613056559e1b58cb3f}


\-Definition at line 742 of file \-Terrain\-Anaysis.\-cpp.



\-References \-L\-O\-G\-M\-E\-S\-S\-A\-G\-E\-W\-A\-R\-N\-I\-N\-G.



\-Referenced by create\-Regions().


\begin{DoxyCode}
{
        //Removes a chokepoint and if its a real one will merge the 2 regions

        Region reg1 = chokeToRemove->getRegions().first;
        Region reg2 = chokeToRemove->getRegions().second;

        if(reg1)
                reg1->removeChokepoint(chokeToRemove);

        if(reg2 && reg2 != reg1)
                reg2->removeChokepoint(chokeToRemove);

        // choke is real, need to merge the regions
        if(reg1 && reg2 && reg1 != reg2)
        {
                LOGMESSAGEWARNING("Tries to Merge 2 regions but is not
       implemented");
        }
}\end{DoxyCode}


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




\subsection{\-Member \-Data \-Documentation}
\hypertarget{classTerrainAnaysisClass_a81fed7acd119a0ebc42049c86a9b8a90}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Chokepoints@{m\-Chokepoints}}
\index{m\-Chokepoints@{m\-Chokepoints}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Chokepoints}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<${\bf \-Chokepoint}$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Chokepoints}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a81fed7acd119a0ebc42049c86a9b8a90}


\-Definition at line 33 of file \-Terrain\-Anaysis.\-h.



\-Referenced by create\-Regions(), finalise\-Connectivity(), and get\-Chokepoints().

\hypertarget{classTerrainAnaysisClass_a65e3e67878d8ab5b52f36e0b7094c41d}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Regions@{m\-Regions}}
\index{m\-Regions@{m\-Regions}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Regions}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<${\bf \-Region}$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Regions}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a65e3e67878d8ab5b52f36e0b7094c41d}


\-Definition at line 34 of file \-Terrain\-Anaysis.\-h.



\-Referenced by create\-Bases(), create\-Regions(), finalise\-Connectivity(), and get\-Regions().

\hypertarget{classTerrainAnaysisClass_a05bcb804882316dcb4426ebe4fb89735}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Small\-Obstacles@{m\-Small\-Obstacles}}
\index{m\-Small\-Obstacles@{m\-Small\-Obstacles}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Small\-Obstacles}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$int$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Small\-Obstacles}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a05bcb804882316dcb4426ebe4fb89735}


\-Definition at line 38 of file \-Terrain\-Anaysis.\-h.



\-Referenced by calculate\-Connectivity(), and calculate\-Walk\-Tile\-Clearance().

\hypertarget{classTerrainAnaysisClass_aef0daf221be0ea05c17646df4c9b25b7}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Tile\-Clearance@{m\-Tile\-Clearance}}
\index{m\-Tile\-Clearance@{m\-Tile\-Clearance}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Tile\-Clearance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Rectangle\-Array}$<$int$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Tile\-Clearance}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_aef0daf221be0ea05c17646df4c9b25b7}


\-Definition at line 40 of file \-Terrain\-Anaysis.\-h.



\-Referenced by calculate\-Walk\-Tile\-Clearance(), create\-Regions(), and get\-Walk\-Clearance().

\hypertarget{classTerrainAnaysisClass_a61e34fd4a1e18f91396660f0a2fcaa98}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Tile\-Closest\-Obstacle@{m\-Tile\-Closest\-Obstacle}}
\index{m\-Tile\-Closest\-Obstacle@{m\-Tile\-Closest\-Obstacle}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Tile\-Closest\-Obstacle}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Rectangle\-Array}$<${\bf \-Walk\-Position}$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Tile\-Closest\-Obstacle}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a61e34fd4a1e18f91396660f0a2fcaa98}


\-Definition at line 41 of file \-Terrain\-Anaysis.\-h.



\-Referenced by calculate\-Walk\-Tile\-Clearance(), and find\-Choke\-Point().

\hypertarget{classTerrainAnaysisClass_a27dfba6799119df0ad90a29872bbf544}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Tile\-Connectivity@{m\-Tile\-Connectivity}}
\index{m\-Tile\-Connectivity@{m\-Tile\-Connectivity}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Tile\-Connectivity}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Rectangle\-Array}$<$int$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Tile\-Connectivity}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_a27dfba6799119df0ad90a29872bbf544}


\-Definition at line 37 of file \-Terrain\-Anaysis.\-h.



\-Referenced by calculate\-Connectivity(), calculate\-Walk\-Tile\-Clearance(), and get\-Walk\-Connectivity().

\hypertarget{classTerrainAnaysisClass_ab1ea66a6f586a89fe387bfe04e7052b0}{\index{\-Terrain\-Anaysis\-Class@{\-Terrain\-Anaysis\-Class}!m\-Tile\-To\-Region@{m\-Tile\-To\-Region}}
\index{m\-Tile\-To\-Region@{m\-Tile\-To\-Region}!TerrainAnaysisClass@{\-Terrain\-Anaysis\-Class}}
\subsubsection[{m\-Tile\-To\-Region}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Rectangle\-Array}$<${\bf \-Region}$>$ {\bf \-Terrain\-Anaysis\-Class\-::m\-Tile\-To\-Region}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classTerrainAnaysisClass_ab1ea66a6f586a89fe387bfe04e7052b0}


\-Definition at line 35 of file \-Terrain\-Anaysis.\-h.



\-Referenced by create\-Bases(), create\-Regions(), and get\-Region().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{TerrainAnaysis_8h}{\-Terrain\-Anaysis.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{TerrainAnaysis_8cpp}{\-Terrain\-Anaysis.\-cpp}\end{DoxyCompactItemize}
