\hypertarget{classUnitGroup}{\section{\-Unit\-Group \-Class \-Reference}
\label{classUnitGroup}\index{\-Unit\-Group@{\-Unit\-Group}}
}


{\ttfamily \#include $<$\-Unit\-Group.\-h$>$}

\subsection*{\-Public \-Types}
\begin{DoxyCompactItemize}
\item 
typedef std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} \hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator}
\item 
typedef std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\*
\-::\hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator} \hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator}
\end{DoxyCompactItemize}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classUnitGroup_a69481085a14e8d325bd46cbfb41898be}{\-Unit\-Group} ()
\item 
int \hyperlink{classUnitGroup_a2586676a5f1a3fc09c00c83258aebf2a}{count\-Completed\-By} (int time) const 
\item 
int \hyperlink{classUnitGroup_affdf4d60bbf8d94ee43fb2ebf8e57e43}{rating\-Difference} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other) const 
\item 
bool \hyperlink{classUnitGroup_ae959b283bf669bc8b5e5cfdc2f98724d}{is\-Worth\-Engaging} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other) const 
\item 
\hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classUnitGroup_a45b8b2fc36688cadc8fac83269ff56a4}{get\-Center} () const 
\item 
\hyperlink{classUnitGroup}{\-Unit\-Group} \hyperlink{classUnitGroup_a6776523734482c8e92aa839638377250}{get\-Best\-Fitting\-To\-Circle} (int circle\-Size, int in\-Frames\-Time=0) const 
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classUnitGroup_afae1b7bb02ac750bd3a633c5272be81f}{get\-Closest\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classUnitGroup_a6751b6d424fe94e4e927d254449f8190}{get\-Closest\-Unit} (\hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} position) const 
\item 
bool \hyperlink{classUnitGroup_adaee13a27eef03ec8b75e48fab1e4608}{is\-Any\-In\-Range} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other\-Group) const 
\item 
int \hyperlink{classUnitGroup_af6145238fef836d1eda532782873e42a}{min\-Distance\-Between} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other\-Group) const 
\item 
int \hyperlink{classUnitGroup_ae4ce3a62d5d598d328c2753318e4fbf6}{get\-Build\-Score} () const 
\item 
int \hyperlink{classUnitGroup_a6c39cf41a0657e820e32ac6cdd38f3a4}{get\-Average\-Terrain\-Height} () const 
\item 
double \hyperlink{classUnitGroup_afc714921deec3563784b16255365f35e}{get\-Average\-Speed} () const 
\item 
\hyperlink{Chokepoint_8h_ac1a1ed6cb736b2e1294c4740cd6c9e00}{\-Region} \hyperlink{classUnitGroup_ab31534e487acee3e2387173f0f48f6ae}{get\-Majority\-Region} () const 
\item 
bool \hyperlink{classUnitGroup_a7971a6e2e91cbdc14138f73a68c8b55a}{can\-Attack\-Air} () const 
\item 
bool \hyperlink{classUnitGroup_ac416965cfbe690a5254c76ec7e12a05c}{can\-Attack\-Ground} () const 
\item 
bool \hyperlink{classUnitGroup_a3822916e1f2490e93cc6bd91a345b391}{can\-Majority\-Attack} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other) const 
\item 
bool \hyperlink{classUnitGroup_a7966e79c98d29b1f35e2cc0d0ec9a872}{has\-Detection} () const 
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::size\-\_\-type \hyperlink{classUnitGroup_a849cba7a2fbc977459b1bb0669647bc1}{get\-Cloaked\-Count} () const 
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::size\-\_\-type \hyperlink{classUnitGroup_a3d2ad745ee14ba84b8c48b2cf37095e6}{get\-Flying\-Count} () const 
\item 
\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} \hyperlink{classUnitGroup_ad3fdcbdcfefab01e70adac5732258cd4}{begin} ()
\item 
\hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator} \hyperlink{classUnitGroup_a88edf33b600b9c13c20992f83bac3188}{begin} () const 
\item 
\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} \hyperlink{classUnitGroup_a98fce0eeb14808bca89fa866023b1d3e}{end} ()
\item 
\hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator} \hyperlink{classUnitGroup_a9ed6629396e3cd632eb4f8827a3f164a}{end} () const 
\item 
void \hyperlink{classUnitGroup_a0344a7b17d6bfc64b31fd284ddcc1864}{clear} ()
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::size\-\_\-type \hyperlink{classUnitGroup_abb47397faa62695b91874e1b4ae07dcf}{count} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} const \&unit) const 
\item 
bool \hyperlink{classUnitGroup_a89db57006f0302f69a9136ddac030689}{empty} () const 
\item 
void \hyperlink{classUnitGroup_a7bd4a3c1b75b1eac1ab8cbbac02fd215}{erase} (\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} position)
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::size\-\_\-type \hyperlink{classUnitGroup_aef2d187284e96d3e4d713618af36c99a}{erase} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} const \&unit)
\item 
void \hyperlink{classUnitGroup_afe2797777a9408da5e293ed15f1aab6f}{erase} (\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} first, \hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} last)
\item 
\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} \hyperlink{classUnitGroup_a9c51b9007e45759c5cc65722545f4c48}{find} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} const \&unit)
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::\hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator} \hyperlink{classUnitGroup_a970acc1d0e054e7e674dca8eba175ce1}{find} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} const \&unit) const 
\item 
std\-::pair$<$ \hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator}, bool $>$ \hyperlink{classUnitGroup_aeb4b65adba58bba4c9e5bdcd869d7a8b}{insert} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} const \&unit)
\item 
\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} \hyperlink{classUnitGroup_af0ba8a474a760c92f643c900e2866b5e}{insert} (\hyperlink{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{iterator} position, \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} const \&unit)
\item 
void \hyperlink{classUnitGroup_a2322af2b51e82cebeb4d0bde7cec4efc}{insert} (\hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator} first, \hyperlink{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{const\-\_\-iterator} last)
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$\-::size\-\_\-type \hyperlink{classUnitGroup_aa1d35c9432defa936b35dd3dc4f5ae0d}{size} () const 
\item 
bool \hyperlink{classUnitGroup_a6f512ea5dae39fd8c26eb2475716fa6f}{operator==} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other) const 
\item 
bool \hyperlink{classUnitGroup_a860d8639ceed8fdee5a5df6076b60403}{operator!=} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other) const 
\item 
\hyperlink{classUnitGroup_af477bd2b1fbe2307cec74fd90bdba9f4}{operator std\-::set$<$ Unit $>$} () const 
\item 
\hyperlink{classUnitGroup}{\-Unit\-Group} \& \hyperlink{classUnitGroup_ab4dbc52364ed827cb26a0677c005376b}{operator+=} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other)
\item 
\hyperlink{classUnitGroup}{\-Unit\-Group} \hyperlink{classUnitGroup_afb2a24e3a370874bbc3ee25e85f8ce46}{operator+} (const \hyperlink{classUnitGroup}{\-Unit\-Group} \&other) const 
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
std\-::set$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} $>$ \hyperlink{classUnitGroup_ab8281f28b7180099579a5a22f79c067f}{m\-Units}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 8 of file \-Unit\-Group.\-h.



\subsection{\-Member \-Typedef \-Documentation}
\hypertarget{classUnitGroup_a0a51d42122f1558861db311b31c77eda}{\index{\-Unit\-Group@{\-Unit\-Group}!const\-\_\-iterator@{const\-\_\-iterator}}
\index{const\-\_\-iterator@{const\-\_\-iterator}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{const\-\_\-iterator}]{\setlength{\rightskip}{0pt plus 5cm}typedef std\-::set$<${\bf \-Unit}$>$\-::{\bf const\-\_\-iterator} {\bf \-Unit\-Group\-::const\-\_\-iterator}}}\label{classUnitGroup_a0a51d42122f1558861db311b31c77eda}


\-Definition at line 46 of file \-Unit\-Group.\-h.

\hypertarget{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}{\index{\-Unit\-Group@{\-Unit\-Group}!iterator@{iterator}}
\index{iterator@{iterator}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{iterator}]{\setlength{\rightskip}{0pt plus 5cm}typedef std\-::set$<${\bf \-Unit}$>$\-::{\bf iterator} {\bf \-Unit\-Group\-::iterator}}}\label{classUnitGroup_a5c59590c65ec13378dce8edf32e6ac8e}


\-Definition at line 45 of file \-Unit\-Group.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classUnitGroup_a69481085a14e8d325bd46cbfb41898be}{\index{\-Unit\-Group@{\-Unit\-Group}!\-Unit\-Group@{\-Unit\-Group}}
\index{\-Unit\-Group@{\-Unit\-Group}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{\-Unit\-Group}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group\-::\-Unit\-Group} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_a69481085a14e8d325bd46cbfb41898be}


\-Definition at line 7 of file \-Unit\-Group.\-cpp.


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


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classUnitGroup_ad3fdcbdcfefab01e70adac5732258cd4}{\index{\-Unit\-Group@{\-Unit\-Group}!begin@{begin}}
\index{begin@{begin}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{begin}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::{\bf iterator} {\bf \-Unit\-Group\-::begin} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_ad3fdcbdcfefab01e70adac5732258cd4}


\-Definition at line 24 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Terrain\-Anaysis\-Class\-::create\-Bases(), get\-Center(), \-Mine\-Blocking\-Mineral\-Task\-::pre\-Update(), \-Unit\-Tracker\-Class\-::update(), \-Base\-Class\-::update(), and \-Mine\-Blocking\-Mineral\-Task\-::update\-Requirements().


\begin{DoxyCode}
{
        return mUnits.begin();
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a88edf33b600b9c13c20992f83bac3188}{\index{\-Unit\-Group@{\-Unit\-Group}!begin@{begin}}
\index{begin@{begin}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{begin}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::{\bf const\-\_\-iterator} {\bf \-Unit\-Group\-::begin} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a88edf33b600b9c13c20992f83bac3188}


\-Definition at line 29 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits.begin();
}
\end{DoxyCode}
\hypertarget{classUnitGroup_a7971a6e2e91cbdc14138f73a68c8b55a}{\index{\-Unit\-Group@{\-Unit\-Group}!can\-Attack\-Air@{can\-Attack\-Air}}
\index{can\-Attack\-Air@{can\-Attack\-Air}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{can\-Attack\-Air}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::can\-Attack\-Air} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a7971a6e2e91cbdc14138f73a68c8b55a}


\-Definition at line 445 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by is\-Worth\-Engaging().


\begin{DoxyCode}
{
        for each(Unit unit in mUnits)
        {
                if(unit->canAttackAir())
                        return true;
        }

        return false;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_ac416965cfbe690a5254c76ec7e12a05c}{\index{\-Unit\-Group@{\-Unit\-Group}!can\-Attack\-Ground@{can\-Attack\-Ground}}
\index{can\-Attack\-Ground@{can\-Attack\-Ground}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{can\-Attack\-Ground}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::can\-Attack\-Ground} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_ac416965cfbe690a5254c76ec7e12a05c}


\-Definition at line 456 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        for each(Unit unit in mUnits)
        {
                if(unit->canAttackGround())
                        return true;
        }

        return false;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_a3822916e1f2490e93cc6bd91a345b391}{\index{\-Unit\-Group@{\-Unit\-Group}!can\-Majority\-Attack@{can\-Majority\-Attack}}
\index{can\-Majority\-Attack@{can\-Majority\-Attack}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{can\-Majority\-Attack}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::can\-Majority\-Attack} (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a3822916e1f2490e93cc6bd91a345b391}


\-Definition at line 467 of file \-Unit\-Group.\-cpp.



\-References empty(), m\-Units, and size().



\-Referenced by \-Default\-Squad\-Task\-::update().


\begin{DoxyCode}
{
        if(empty() || other.empty())
                return false;

        double thisGroupAttackCount = 0.0;
        for each(Unit thisUnit in mUnits)
        {
                for each(Unit otherUnit in other)
                {
                        if(thisUnit->canAttack(otherUnit))
                                ++thisGroupAttackCount;
                }
        }

        thisGroupAttackCount /= other.size();
        thisGroupAttackCount /= size();

        return thisGroupAttackCount > 0.5;
}\end{DoxyCode}


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




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


\hypertarget{classUnitGroup_a0344a7b17d6bfc64b31fd284ddcc1864}{\index{\-Unit\-Group@{\-Unit\-Group}!clear@{clear}}
\index{clear@{clear}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{clear}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Unit\-Group\-::clear} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_a0344a7b17d6bfc64b31fd284ddcc1864}


\-Definition at line 44 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Base\-Class\-::update().


\begin{DoxyCode}
{
        mUnits.clear();
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_abb47397faa62695b91874e1b4ae07dcf}{\index{\-Unit\-Group@{\-Unit\-Group}!count@{count}}
\index{count@{count}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{count}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::size\-\_\-type {\bf \-Unit\-Group\-::count} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit} const \&}]{unit}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_abb47397faa62695b91874e1b4ae07dcf}


\-Definition at line 49 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Pylon\-Power\-Tracker\-Class\-::on\-Add\-Pylon(), \-Pylon\-Power\-Tracker\-Class\-::on\-Remove\-Pylon(), \-Advanced\-Group\-::update(), \-Resource\-Manager\-Class\-::update(), and \-Default\-Squad\-Task\-::update\-Requirements().


\begin{DoxyCode}
{
        return mUnits.count(unit);
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a2586676a5f1a3fc09c00c83258aebf2a}{\index{\-Unit\-Group@{\-Unit\-Group}!count\-Completed\-By@{count\-Completed\-By}}
\index{count\-Completed\-By@{count\-Completed\-By}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{count\-Completed\-By}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Unit\-Group\-::count\-Completed\-By} (
\begin{DoxyParamCaption}
\item[{int}]{time}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a2586676a5f1a3fc09c00c83258aebf2a}


\-Definition at line 11 of file \-Unit\-Group.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Game\-::get\-Frame\-Count(), and m\-Units.


\begin{DoxyCode}
{
        const int &timeNow = BWAPI::Broodwar->getFrameCount();

        int total = 0;
        for each(Unit unit in mUnits)
        {
                if(unit->isCompleted() || unit->getCompletedTime() <= time)
                        ++total;
        }
        return total;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a89db57006f0302f69a9136ddac030689}{\index{\-Unit\-Group@{\-Unit\-Group}!empty@{empty}}
\index{empty@{empty}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{empty}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::empty} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a89db57006f0302f69a9136ddac030689}


\-Definition at line 54 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by can\-Majority\-Attack(), \-Base\-Class\-::draw\-Debug\-Info(), get\-Center(), \-Group\-Micro\-Action\-Base\-Class\-::has\-Ended(), is\-Worth\-Engaging(), \-Mine\-Blocking\-Mineral\-Task\-::pre\-Update(), \-Arbiter\-Action\-::update(), \-Psi\-Storm\-Action\-::update(), \-Advanced\-Group\-::update(), \-Pylon\-Power\-Tracker\-Class\-::update(), \-Defense\-Squad\-Task\-::update(), \-Default\-Squad\-Task\-::update(), \-Base\-Class\-::update(), and \-Mine\-Blocking\-Mineral\-Task\-::update\-Requirements().


\begin{DoxyCode}
{
        return mUnits.empty();
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a98fce0eeb14808bca89fa866023b1d3e}{\index{\-Unit\-Group@{\-Unit\-Group}!end@{end}}
\index{end@{end}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{end}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::{\bf iterator} {\bf \-Unit\-Group\-::end} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_a98fce0eeb14808bca89fa866023b1d3e}


\-Definition at line 34 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Terrain\-Anaysis\-Class\-::create\-Bases(), \-Mine\-Blocking\-Mineral\-Task\-::pre\-Update(), \-Base\-Class\-::remove\-Unit(), \-Unit\-Tracker\-Class\-::update(), and \-Base\-Class\-::update().


\begin{DoxyCode}
{
        return mUnits.end();
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a9ed6629396e3cd632eb4f8827a3f164a}{\index{\-Unit\-Group@{\-Unit\-Group}!end@{end}}
\index{end@{end}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{end}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::{\bf const\-\_\-iterator} {\bf \-Unit\-Group\-::end} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a9ed6629396e3cd632eb4f8827a3f164a}


\-Definition at line 39 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits.end();
}
\end{DoxyCode}
\hypertarget{classUnitGroup_a7bd4a3c1b75b1eac1ab8cbbac02fd215}{\index{\-Unit\-Group@{\-Unit\-Group}!erase@{erase}}
\index{erase@{erase}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{erase}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Unit\-Group\-::erase} (
\begin{DoxyParamCaption}
\item[{{\bf iterator}}]{position}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_a7bd4a3c1b75b1eac1ab8cbbac02fd215}


\-Referenced by \-Unit\-Predictor\-Class\-::delete\-Prediction(), \-Unit\-Tracker\-Class\-::on\-Destroy(), \-Unit\-Tracker\-Class\-::on\-Morph\-Renegade(), \-Pylon\-Power\-Tracker\-Class\-::on\-Remove\-Pylon(), \-Mine\-Blocking\-Mineral\-Task\-::pre\-Update(), \-Drop\-Action\-::remove\-Unit(), \-Group\-Micro\-Action\-Base\-Class\-::remove\-Unit(), \-Base\-Class\-::remove\-Unit(), \-Advanced\-Group\-::remove\-Units(), \-Defense\-Squad\-Task\-::return\-Unit(), \-Default\-Squad\-Task\-::return\-Unit(), and \-Psi\-Storm\-Action\-::update().



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


\hypertarget{classUnitGroup_aef2d187284e96d3e4d713618af36c99a}{\index{\-Unit\-Group@{\-Unit\-Group}!erase@{erase}}
\index{erase@{erase}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{erase}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::size\-\_\-type {\bf \-Unit\-Group\-::erase} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit} const \&}]{unit}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_aef2d187284e96d3e4d713618af36c99a}


\-Definition at line 64 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits.erase(unit);
}
\end{DoxyCode}
\hypertarget{classUnitGroup_afe2797777a9408da5e293ed15f1aab6f}{\index{\-Unit\-Group@{\-Unit\-Group}!erase@{erase}}
\index{erase@{erase}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{erase}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Unit\-Group\-::erase} (
\begin{DoxyParamCaption}
\item[{{\bf iterator}}]{first, }
\item[{{\bf iterator}}]{last}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_afe2797777a9408da5e293ed15f1aab6f}
\hypertarget{classUnitGroup_a9c51b9007e45759c5cc65722545f4c48}{\index{\-Unit\-Group@{\-Unit\-Group}!find@{find}}
\index{find@{find}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{find}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::{\bf iterator} {\bf \-Unit\-Group\-::find} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit} const \&}]{unit}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_a9c51b9007e45759c5cc65722545f4c48}


\-Definition at line 74 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Base\-Class\-::remove\-Unit().


\begin{DoxyCode}
{
        return mUnits.find(unit);
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a970acc1d0e054e7e674dca8eba175ce1}{\index{\-Unit\-Group@{\-Unit\-Group}!find@{find}}
\index{find@{find}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{find}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::{\bf const\-\_\-iterator} {\bf \-Unit\-Group\-::find} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit} const \&}]{unit}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a970acc1d0e054e7e674dca8eba175ce1}


\-Definition at line 79 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits.find(unit);
}
\end{DoxyCode}
\hypertarget{classUnitGroup_afc714921deec3563784b16255365f35e}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Average\-Speed@{get\-Average\-Speed}}
\index{get\-Average\-Speed@{get\-Average\-Speed}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Average\-Speed}]{\setlength{\rightskip}{0pt plus 5cm}double {\bf \-Unit\-Group\-::get\-Average\-Speed} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_afc714921deec3563784b16255365f35e}


\-Definition at line 376 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by is\-Worth\-Engaging().


\begin{DoxyCode}
{
        double averageSpeed = 0;
        for each(Unit unit in mUnits)
        {
                averageSpeed += unit->getType().topSpeed();
        }

        return averageSpeed / double(mUnits.size());
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a6c39cf41a0657e820e32ac6cdd38f3a4}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Average\-Terrain\-Height@{get\-Average\-Terrain\-Height}}
\index{get\-Average\-Terrain\-Height@{get\-Average\-Terrain\-Height}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Average\-Terrain\-Height}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Unit\-Group\-::get\-Average\-Terrain\-Height} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a6c39cf41a0657e820e32ac6cdd38f3a4}


\-Definition at line 365 of file \-Unit\-Group.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Game\-::get\-Ground\-Height(), and m\-Units.


\begin{DoxyCode}
{
        int height = 0;
        for each(Unit unit in mUnits)
        {
                height += BWAPI::Broodwar->getGroundHeight(unit->
      getTilePosition());
        }

        return height / mUnits.size();
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a6776523734482c8e92aa839638377250}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Best\-Fitting\-To\-Circle@{get\-Best\-Fitting\-To\-Circle}}
\index{get\-Best\-Fitting\-To\-Circle@{get\-Best\-Fitting\-To\-Circle}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Best\-Fitting\-To\-Circle}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group} {\bf \-Unit\-Group\-::get\-Best\-Fitting\-To\-Circle} (
\begin{DoxyParamCaption}
\item[{int}]{circle\-Size, }
\item[{int}]{in\-Frames\-Time = {\ttfamily 0}}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a6776523734482c8e92aa839638377250}


\-Definition at line 191 of file \-Unit\-Group.\-cpp.



\-References get\-Center(), and \-B\-W\-A\-P\-I\-::\-Position\-::get\-Distance().



\-Referenced by \-Arbiter\-Action\-::update(), and \-Psi\-Storm\-Action\-::update().


\begin{DoxyCode}
{
        UnitGroup circleUnits(*this);
        bool removed = false;
        do
        {
                removed = false;
                Position center = circleUnits.getCenter();

                Unit furthestUnit;
                int furthestDistance = 0;

                for each(Unit unit in circleUnits)
                {
                        int distanceToCenter;
                        if(inFramesTime == 0)
                                distanceToCenter = unit->getDistance(center);
                        else
                                distanceToCenter = unit->getDistance(center, 
      inFramesTime);

                        if(distanceToCenter > circleSize && distanceToCenter > 
      furthestDistance)
                        {
                                furthestUnit = unit;
                                furthestDistance = distanceToCenter;
                        }
                }

                if(furthestUnit)
                {
                        circleUnits.erase(furthestUnit);
                        removed = true;
                }
        }
        while(removed);

        return circleUnits;
}
\end{DoxyCode}


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




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


\hypertarget{classUnitGroup_ae4ce3a62d5d598d328c2753318e4fbf6}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Build\-Score@{get\-Build\-Score}}
\index{get\-Build\-Score@{get\-Build\-Score}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Build\-Score}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Unit\-Group\-::get\-Build\-Score} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_ae4ce3a62d5d598d328c2753318e4fbf6}


\-Definition at line 302 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        int rating = 0;
        for each(Unit unit in mUnits)
        {
                rating += unit->getType().buildScore();
        }

        return rating;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_a45b8b2fc36688cadc8fac83269ff56a4}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Center@{get\-Center}}
\index{get\-Center@{get\-Center}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Center}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Position} {\bf \-Unit\-Group\-::get\-Center} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a45b8b2fc36688cadc8fac83269ff56a4}


\-Definition at line 153 of file \-Unit\-Group.\-cpp.



\-References begin(), empty(), m\-Units, \-B\-W\-A\-P\-I\-::\-Bullet\-Types\-::\-None, and size().



\-Referenced by \-Terrain\-Anaysis\-Class\-::create\-Bases(), get\-Best\-Fitting\-To\-Circle(), \-Goal\-::get\-Position\-For\-Merge(), \-Psi\-Storm\-Action\-::update(), and \-Arbiter\-Action\-::update().


\begin{DoxyCode}
{
        if(empty())
                return BWAPI::Positions::None;

        if(size() == 1)
                return (*begin())->getPosition();

        Vector position;

        for each(Unit unit in mUnits)
        {
                position += Vector(unit->getPosition());
        }

        return position / float(size());
}
\end{DoxyCode}


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




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


\hypertarget{classUnitGroup_a849cba7a2fbc977459b1bb0669647bc1}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Cloaked\-Count@{get\-Cloaked\-Count}}
\index{get\-Cloaked\-Count@{get\-Cloaked\-Count}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Cloaked\-Count}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::size\-\_\-type {\bf \-Unit\-Group\-::get\-Cloaked\-Count} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a849cba7a2fbc977459b1bb0669647bc1}


\-Definition at line 421 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by is\-Worth\-Engaging().


\begin{DoxyCode}
{
        std::set<Unit>::size_type cloakedCount = 0;
        for each(Unit unit in mUnits)
        {
                if(unit->getType().hasPermanentCloak() || unit->isCloaked())
                        ++cloakedCount;
        }

        return cloakedCount;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_afae1b7bb02ac750bd3a633c5272be81f}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Closest\-Unit@{get\-Closest\-Unit}}
\index{get\-Closest\-Unit@{get\-Closest\-Unit}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Closest\-Unit}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Unit\-Group\-::get\-Closest\-Unit} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_afae1b7bb02ac750bd3a633c5272be81f}


\-Definition at line 229 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Goal\-Action\-::update(), and \-Advanced\-Group\-::update().


\begin{DoxyCode}
{
        Unit closestUnit;
        int closestDistance = std::numeric_limits<int>::max();

        for each(Unit groupUnit in mUnits)
        {
                int thisDistance = unit->getDistance(groupUnit);
                if(thisDistance < closestDistance)
                {
                        closestDistance = thisDistance;
                        closestUnit = groupUnit;
                }
        }

        return closestUnit;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a6751b6d424fe94e4e927d254449f8190}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Closest\-Unit@{get\-Closest\-Unit}}
\index{get\-Closest\-Unit@{get\-Closest\-Unit}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Closest\-Unit}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Unit\-Group\-::get\-Closest\-Unit} (
\begin{DoxyParamCaption}
\item[{{\bf \-Position}}]{position}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a6751b6d424fe94e4e927d254449f8190}


\-Definition at line 247 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        Unit closestUnit;
        int closestDistance = std::numeric_limits<int>::max();

        for each(Unit groupUnit in mUnits)
        {
                int thisDistance = groupUnit->getDistance(position);
                if(thisDistance < closestDistance)
                {
                        closestDistance = thisDistance;
                        closestUnit = groupUnit;
                }
        }

        return closestUnit;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_a3d2ad745ee14ba84b8c48b2cf37095e6}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Flying\-Count@{get\-Flying\-Count}}
\index{get\-Flying\-Count@{get\-Flying\-Count}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Flying\-Count}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::size\-\_\-type {\bf \-Unit\-Group\-::get\-Flying\-Count} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a3d2ad745ee14ba84b8c48b2cf37095e6}


\-Definition at line 433 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by is\-Worth\-Engaging().


\begin{DoxyCode}
{
        std::set<Unit>::size_type flyingCount = 0;
        for each(Unit unit in mUnits)
        {
                if(unit->getType().isFlyer() || unit->isLifted())
                        ++flyingCount;
        }

        return flyingCount;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_ab31534e487acee3e2387173f0f48f6ae}{\index{\-Unit\-Group@{\-Unit\-Group}!get\-Majority\-Region@{get\-Majority\-Region}}
\index{get\-Majority\-Region@{get\-Majority\-Region}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{get\-Majority\-Region}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Region} {\bf \-Unit\-Group\-::get\-Majority\-Region} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_ab31534e487acee3e2387173f0f48f6ae}


\-Definition at line 387 of file \-Unit\-Group.\-cpp.



\-References \-Singleton$<$ T $>$\-::\-Instance(), and m\-Units.



\-Referenced by is\-Worth\-Engaging().


\begin{DoxyCode}
{
        int currentCount = 1;
        Region currentCandidate;

        for each(Unit unit in mUnits)
        {
                const Region &thisRegion = TerrainAnaysis::Instance().getRegion
      (unit->getPosition());
                if(thisRegion == currentCandidate)
                        ++currentCount;
                else
                        --currentCount;

                if(currentCount == 0)
                {
                        currentCandidate = thisRegion;
                        currentCount = 1;
                }
        }

        return currentCandidate;
}
\end{DoxyCode}


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




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


\hypertarget{classUnitGroup_a7966e79c98d29b1f35e2cc0d0ec9a872}{\index{\-Unit\-Group@{\-Unit\-Group}!has\-Detection@{has\-Detection}}
\index{has\-Detection@{has\-Detection}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{has\-Detection}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::has\-Detection} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a7966e79c98d29b1f35e2cc0d0ec9a872}


\-Definition at line 410 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by is\-Worth\-Engaging().


\begin{DoxyCode}
{
        for each(Unit unit in mUnits)
        {
                if(unit->getType().isDetector())
                        return true;
        }

        return false;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_aeb4b65adba58bba4c9e5bdcd869d7a8b}{\index{\-Unit\-Group@{\-Unit\-Group}!insert@{insert}}
\index{insert@{insert}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{insert}]{\setlength{\rightskip}{0pt plus 5cm}std\-::pair$<$ std\-::set$<$ {\bf \-Unit} $>$\-::{\bf iterator}, bool $>$ {\bf \-Unit\-Group\-::insert} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit} const \&}]{unit}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_aeb4b65adba58bba4c9e5bdcd869d7a8b}


\-Definition at line 84 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Advanced\-Group\-::add\-Unit(), \-Drop\-Action\-::add\-Unit(), \-Group\-Micro\-Action\-Base\-Class\-::add\-Unit(), \-Base\-Class\-::add\-Unit(), \-Base\-Class\-::\-Base\-Class(), \-Unit\-Helper\-::get\-Clusters(), \-Tech\-Task\-::get\-Finished\-Units(), \-Train\-Task\-::get\-Finished\-Units(), \-Upgrade\-Task\-::get\-Finished\-Units(), \-Morph\-Task\-::get\-Finished\-Units(), \-Gather\-Task\-::get\-Finished\-Units(), \-Construction\-Task\-::get\-Finished\-Units(), \-Mine\-Blocking\-Mineral\-Task\-::get\-Finished\-Units(), \-Worker\-Scout\-Task\-::get\-Finished\-Units(), \-Observer\-Scout\-Task\-::get\-Finished\-Units(), \-Requirement\-Group\-::get\-Units(), \-Defense\-Squad\-Task\-::give\-Unit(), \-Default\-Squad\-Task\-::give\-Unit(), \-Group\-Micro\-Action\-Base\-Class\-::\-Group\-Micro\-Action\-Base\-Class(), \-Pylon\-Power\-Tracker\-Class\-::on\-Add\-Pylon(), \-Unit\-Tracker\-Class\-::on\-Discover(), \-Unit\-Tracker\-Class\-::on\-Morph\-Renegade(), operator+=(), \-Unit\-Predictor\-Class\-::save\-Prediction(), \-Detector\-Action\-::update(), \-Arbiter\-Action\-::update(), and \-Base\-Class\-::update().


\begin{DoxyCode}
{
        return mUnits.insert(unit);
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_af0ba8a474a760c92f643c900e2866b5e}{\index{\-Unit\-Group@{\-Unit\-Group}!insert@{insert}}
\index{insert@{insert}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{insert}]{\setlength{\rightskip}{0pt plus 5cm}{\bf iterator} {\bf \-Unit\-Group\-::insert} (
\begin{DoxyParamCaption}
\item[{{\bf iterator}}]{position, }
\item[{{\bf \-Unit} const \&}]{unit}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_af0ba8a474a760c92f643c900e2866b5e}
\hypertarget{classUnitGroup_a2322af2b51e82cebeb4d0bde7cec4efc}{\index{\-Unit\-Group@{\-Unit\-Group}!insert@{insert}}
\index{insert@{insert}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{insert}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Unit\-Group\-::insert} (
\begin{DoxyParamCaption}
\item[{{\bf const\-\_\-iterator}}]{first, }
\item[{{\bf const\-\_\-iterator}}]{last}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_a2322af2b51e82cebeb4d0bde7cec4efc}
\hypertarget{classUnitGroup_adaee13a27eef03ec8b75e48fab1e4608}{\index{\-Unit\-Group@{\-Unit\-Group}!is\-Any\-In\-Range@{is\-Any\-In\-Range}}
\index{is\-Any\-In\-Range@{is\-Any\-In\-Range}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{is\-Any\-In\-Range}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::is\-Any\-In\-Range} (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other\-Group}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_adaee13a27eef03ec8b75e48fab1e4608}


\-Definition at line 265 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Default\-Squad\-Task\-::update().


\begin{DoxyCode}
{
        for each(Unit groupUnit in mUnits)
        {
                for each(Unit otherGroupUnit in otherGroup)
                {
                        if(groupUnit->isInRange(otherGroupUnit))
                                return true;
                }
        }

        return false;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_ae959b283bf669bc8b5e5cfdc2f98724d}{\index{\-Unit\-Group@{\-Unit\-Group}!is\-Worth\-Engaging@{is\-Worth\-Engaging}}
\index{is\-Worth\-Engaging@{is\-Worth\-Engaging}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{is\-Worth\-Engaging}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Unit\-Group\-::is\-Worth\-Engaging} (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_ae959b283bf669bc8b5e5cfdc2f98724d}


\-Definition at line 313 of file \-Unit\-Group.\-cpp.



\-References can\-Attack\-Air(), empty(), get\-Average\-Speed(), get\-Cloaked\-Count(), get\-Flying\-Count(), get\-Majority\-Region(), has\-Detection(), and size().



\-Referenced by \-Default\-Squad\-Task\-::update().


\begin{DoxyCode}
{
        // Don't chase after a faster group
        double thisAverageSpeed = getAverageSpeed();
        double otherAverageSpeed = other.getAverageSpeed();
        if(otherAverageSpeed >= thisAverageSpeed)
                return false;

        size_t thisFlyingCount = getFlyingCount();
        double thisFlyingAverage = 0.0;
        if(!empty())
                thisFlyingAverage = thisFlyingCount / size();

        size_t otherFlyingCount = other.getFlyingCount();
        double otherFlyingAverage = 0.0;
        if(!other.empty())
                otherFlyingAverage = otherFlyingCount / other.size();

        if((thisFlyingAverage + 0.3) < otherFlyingAverage)
                return false;

        Region thisRegion = getMajorityRegion();
        Region otherRegion = other.getMajorityRegion();
        if(thisRegion && thisRegion != otherRegion)
        {
                // dont try attacking a group that isnt connected without a
       majority of flying units
                if(!otherRegion || thisRegion->isConnected(otherRegion))
                {
                        if(thisFlyingAverage > 0.5)
                                return false;
                }
        }

        size_t otherCloakedCount = other.getCloakedCount();
        if(!hasDetection() && otherCloakedCount > 0)
        {
                size_t thisCloakedCount = getCloakedCount();
                if(!other.hasDetection() && thisCloakedCount > 0)
                {
                        if(thisCloakedCount < otherCloakedCount)
                                return false;
                }
                else if(otherCloakedCount > 0)
                        return false;
        }

        if(otherFlyingAverage > 0.2 && !canAttackAir())
                return false;

        return true;
}
\end{DoxyCode}


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




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


\hypertarget{classUnitGroup_af6145238fef836d1eda532782873e42a}{\index{\-Unit\-Group@{\-Unit\-Group}!min\-Distance\-Between@{min\-Distance\-Between}}
\index{min\-Distance\-Between@{min\-Distance\-Between}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{min\-Distance\-Between}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Unit\-Group\-::min\-Distance\-Between} (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other\-Group}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_af6145238fef836d1eda532782873e42a}


\-Definition at line 279 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Default\-Squad\-Task\-::update().


\begin{DoxyCode}
{
        int minDistance = std::numeric_limits<int>::max();
        for each(Unit groupUnit in mUnits)
        {
                for each(Unit otherGroupUnit in otherGroup)
                {
                        int thisDistance = otherGroupUnit->getDistance(
      groupUnit);
                        if(thisDistance < minDistance)
                                minDistance = thisDistance;
                }
        }
        return minDistance;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_af477bd2b1fbe2307cec74fd90bdba9f4}{\index{\-Unit\-Group@{\-Unit\-Group}!operator std\-::set$<$ Unit $>$@{operator std\-::set$<$ Unit $>$}}
\index{operator std\-::set$<$ Unit $>$@{operator std\-::set$<$ Unit $>$}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{operator std\-::set$<$ Unit $>$}]{\setlength{\rightskip}{0pt plus 5cm}\-Unit\-Group\-::operator std\-::set$<$ {\bf \-Unit} $>$ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_af477bd2b1fbe2307cec74fd90bdba9f4}


\-Definition at line 104 of file \-Unit\-Group.\-cpp.


\begin{DoxyCode}
{
        return mUnits;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_a860d8639ceed8fdee5a5df6076b60403}{\index{\-Unit\-Group@{\-Unit\-Group}!operator!=@{operator!=}}
\index{operator!=@{operator!=}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{operator!=}]{\setlength{\rightskip}{0pt plus 5cm}bool \-Unit\-Group\-::operator!= (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a860d8639ceed8fdee5a5df6076b60403}


\-Definition at line 176 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits != other.mUnits;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_afb2a24e3a370874bbc3ee25e85f8ce46}{\index{\-Unit\-Group@{\-Unit\-Group}!operator+@{operator+}}
\index{operator+@{operator+}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{operator+}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group} \-Unit\-Group\-::operator+ (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_afb2a24e3a370874bbc3ee25e85f8ce46}


\-Definition at line 294 of file \-Unit\-Group.\-cpp.


\begin{DoxyCode}
{
        UnitGroup ret(*this);
        ret += other;

        return ret;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_ab4dbc52364ed827cb26a0677c005376b}{\index{\-Unit\-Group@{\-Unit\-Group}!operator+=@{operator+=}}
\index{operator+=@{operator+=}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{operator+=}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group} \& \-Unit\-Group\-::operator+= (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
)}}\label{classUnitGroup_ab4dbc52364ed827cb26a0677c005376b}


\-Definition at line 181 of file \-Unit\-Group.\-cpp.



\-References insert().


\begin{DoxyCode}
{
        for each(Unit unit in other)
        {
                insert(unit);
        }

        return *this;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_a6f512ea5dae39fd8c26eb2475716fa6f}{\index{\-Unit\-Group@{\-Unit\-Group}!operator==@{operator==}}
\index{operator==@{operator==}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{operator==}]{\setlength{\rightskip}{0pt plus 5cm}bool \-Unit\-Group\-::operator== (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_a6f512ea5dae39fd8c26eb2475716fa6f}


\-Definition at line 171 of file \-Unit\-Group.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits == other.mUnits;
}
\end{DoxyCode}
\hypertarget{classUnitGroup_affdf4d60bbf8d94ee43fb2ebf8e57e43}{\index{\-Unit\-Group@{\-Unit\-Group}!rating\-Difference@{rating\-Difference}}
\index{rating\-Difference@{rating\-Difference}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{rating\-Difference}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Unit\-Group\-::rating\-Difference} (
\begin{DoxyParamCaption}
\item[{const {\bf \-Unit\-Group} \&}]{other}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_affdf4d60bbf8d94ee43fb2ebf8e57e43}


\-Definition at line 109 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by \-Default\-Squad\-Task\-::update(), and \-Base\-Class\-::update().


\begin{DoxyCode}
{
        // not sure about this, along the right lines with using time to kill
       as that in turns considers weapon damage, terrain, health etc but bad atm
        if(mUnits.empty() && other.mUnits.empty())
                return 0;
        else if(mUnits.empty())
                return -100;
        else if(other.mUnits.empty())
                return 100;

        int OtherKillThisTime = 0;
        int ThisKillOtherTime = 0;
        for each(Unit thisUnit in mUnits)
        {
                for each(Unit otherUnit in other.mUnits)
                {
                        if(otherUnit->canAttack(thisUnit) && !thisUnit->
      isUnderDarkSwarm() && otherUnit->getDistance(thisUnit) < 600)
                        {
                                int killTime = otherUnit->getTimeToKill(
      thisUnit);
                                if(otherUnit->getType().groundWeapon().
      outerSplashRadius() > 15)
                                        killTime /= 2;

                                OtherKillThisTime += std::min(killTime, 500);
                        }
                        else
                                OtherKillThisTime += 500;

                        if(thisUnit->canAttack(otherUnit) && !otherUnit->
      isUnderDarkSwarm() && thisUnit->getDistance(otherUnit) < 600)
                                ThisKillOtherTime += std::min(thisUnit->
      getTimeToKill(otherUnit), 500);
                        else
                                ThisKillOtherTime += 500;
                }
        }

        OtherKillThisTime /= other.mUnits.size();
        ThisKillOtherTime /= mUnits.size();

        int ratingTotal = std::max(OtherKillThisTime, ThisKillOtherTime) - 
      std::min(OtherKillThisTime, ThisKillOtherTime);
        if(OtherKillThisTime < ThisKillOtherTime)
                ratingTotal = 0 - ratingTotal;

        return ratingTotal;
}
\end{DoxyCode}


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


\hypertarget{classUnitGroup_aa1d35c9432defa936b35dd3dc4f5ae0d}{\index{\-Unit\-Group@{\-Unit\-Group}!size@{size}}
\index{size@{size}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<$ {\bf \-Unit} $>$\-::size\-\_\-type {\bf \-Unit\-Group\-::size} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}\label{classUnitGroup_aa1d35c9432defa936b35dd3dc4f5ae0d}


\-Definition at line 99 of file \-Unit\-Group.\-cpp.



\-References m\-Units.



\-Referenced by can\-Majority\-Attack(), \-Defense\-Squad\-Task\-::control\-Size(), \-Default\-Squad\-Task\-::control\-Size(), \-Base\-Class\-::draw\-Debug\-Info(), get\-Center(), \-Defense\-Squad\-Task\-::get\-Priority(), is\-Worth\-Engaging(), \-Psi\-Storm\-Action\-::update(), \-Arbiter\-Action\-::update(), \-Default\-Squad\-Task\-::update(), \-Worker\-Scout\-Task\-::update(), \-Base\-Class\-::update(), and \-Defense\-Squad\-Task\-::update\-Requirements().


\begin{DoxyCode}
{
        return mUnits.size();
}
\end{DoxyCode}


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




\subsection{\-Member \-Data \-Documentation}
\hypertarget{classUnitGroup_ab8281f28b7180099579a5a22f79c067f}{\index{\-Unit\-Group@{\-Unit\-Group}!m\-Units@{m\-Units}}
\index{m\-Units@{m\-Units}!UnitGroup@{\-Unit\-Group}}
\subsubsection[{m\-Units}]{\setlength{\rightskip}{0pt plus 5cm}std\-::set$<${\bf \-Unit}$>$ {\bf \-Unit\-Group\-::m\-Units}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classUnitGroup_ab8281f28b7180099579a5a22f79c067f}


\-Definition at line 79 of file \-Unit\-Group.\-h.



\-Referenced by begin(), can\-Attack\-Air(), can\-Attack\-Ground(), can\-Majority\-Attack(), clear(), count(), count\-Completed\-By(), empty(), end(), erase(), find(), get\-Average\-Speed(), get\-Average\-Terrain\-Height(), get\-Build\-Score(), get\-Center(), get\-Cloaked\-Count(), get\-Closest\-Unit(), get\-Flying\-Count(), get\-Majority\-Region(), has\-Detection(), insert(), is\-Any\-In\-Range(), min\-Distance\-Between(), operator!=(), operator==(), rating\-Difference(), and size().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{UnitGroup_8h}{\-Unit\-Group.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{UnitGroup_8cpp}{\-Unit\-Group.\-cpp}\end{DoxyCompactItemize}
