\hypertarget{classDefaultSquadTask}{\section{\-Default\-Squad\-Task \-Class \-Reference}
\label{classDefaultSquadTask}\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}}
}


{\ttfamily \#include $<$\-Default\-Squad.\-h$>$}



\-Inheritance diagram for \-Default\-Squad\-Task\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=550pt]{classDefaultSquadTask__inherit__graph}
\end{center}
\end{figure}


\-Collaboration diagram for \-Default\-Squad\-Task\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classDefaultSquadTask__coll__graph}
\end{center}
\end{figure}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classDefaultSquadTask_aeec7f68e3fc10cdb8d0baf1f3768ed7d}{\-Default\-Squad\-Task} (\hyperlink{BuildOrder_8h_a542f03dc7d3ea96b4a75927437d0fd4a}{\-Army\-Behaviour} behaviour)
\item 
virtual int \hyperlink{classDefaultSquadTask_a1e67d1b996ed63de757a48fecd472da5}{get\-End\-Time} () const 
\item 
virtual int \hyperlink{classDefaultSquadTask_a2bd72d82d7852613c41e50245ea015c6}{get\-End\-Time} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual int \hyperlink{classDefaultSquadTask_a7dc43f08fd55ddd347d92d2cdee32af7}{get\-Priority} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classDefaultSquadTask_aad04bb453d983cff6ce66b0de75c5864}{get\-Start\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classDefaultSquadTask_a9e4a947f5e26d4ff41dae3217462a1a8}{get\-End\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual bool \hyperlink{classDefaultSquadTask_af5ac92ec1117cc964923dad21a020c5d}{pre\-Update} ()
\item 
virtual bool \hyperlink{classDefaultSquadTask_aac23b08605888316ae02b3cb87399d93}{update} ()
\item 
virtual bool \hyperlink{classDefaultSquadTask_aed5fa264e814ccab3c3ebe0fd1d5f072}{waiting\-For\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual void \hyperlink{classDefaultSquadTask_ac21ce4927c39835c7ffc3350f8d52505}{give\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
virtual void \hyperlink{classDefaultSquadTask_afba164784df13426e7162862b7c60e9f}{return\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
virtual bool \hyperlink{classDefaultSquadTask_aa62784b2aebabc27b3c91ec8fabe82f5}{morph} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit, \hyperlink{classBWAPI_1_1UnitType}{\-B\-W\-A\-P\-I\-::\-Unit\-Type} previous\-Type)
\item 
virtual \hyperlink{classUnitGroup}{\-Unit\-Group} \hyperlink{classDefaultSquadTask_a89181f536798d91b4c23c10fecbe141d}{get\-Finished\-Units} ()
\item 
virtual std\-::string \hyperlink{classDefaultSquadTask_ab208d241714ecda7f6b44f8b753fd6d7}{get\-Task\-Name} () const 
\item 
virtual std\-::string \hyperlink{classDefaultSquadTask_af1c9a5f92bf99572e40ec0036351654f}{get\-Output\-Name} () const 
\item 
unsigned int \hyperlink{classDefaultSquadTask_a36d4367567cf8294605fcc831037a9bb}{control\-Size} ()
\item 
virtual void \hyperlink{classDefaultSquadTask_a8d73560f1b84f6089747285805e5ab28}{update\-Requirements} ()
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classUnitGroup}{\-Unit\-Group} \hyperlink{classDefaultSquadTask_a1fa8d895c8e7b97b89428d2e4872e1e5}{m\-Units}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit}, \hyperlink{classBehaviour}{\-Behaviour} $>$ \hyperlink{classDefaultSquadTask_a4e3282fa4077597b348ff567e0c817a0}{m\-Unit\-Behaviours}
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classDefaultSquadTask_a32b20a7becaa6d48e1f5b878a3f6ea64}{m\-Observer}
\item 
\hyperlink{classGoal}{\-Goal} \hyperlink{classDefaultSquadTask_a0a5e791ebb31eabdc9746d9208f03d82}{m\-Last\-Goal}
\item 
bool \hyperlink{classDefaultSquadTask_a248fde85d2ecb8d858c068c2fe4e818b}{m\-Engage\-Full}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 8 of file \-Default\-Squad.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classDefaultSquadTask_aeec7f68e3fc10cdb8d0baf1f3768ed7d}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!\-Default\-Squad\-Task@{\-Default\-Squad\-Task}}
\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{\-Default\-Squad\-Task}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Default\-Squad\-Task\-::\-Default\-Squad\-Task} (
\begin{DoxyParamCaption}
\item[{{\bf \-Army\-Behaviour}}]{behaviour}
\end{DoxyParamCaption}
)}}\label{classDefaultSquadTask_aeec7f68e3fc10cdb8d0baf1f3768ed7d}


\-Definition at line 11 of file \-Default\-Squad.\-cpp.


\begin{DoxyCode}
        : BaseSquadTask(behaviour)
        , mEngageFull(false)
{
}
\end{DoxyCode}


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classDefaultSquadTask_a36d4367567cf8294605fcc831037a9bb}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!control\-Size@{control\-Size}}
\index{control\-Size@{control\-Size}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{control\-Size}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int {\bf \-Default\-Squad\-Task\-::control\-Size} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classDefaultSquadTask_a36d4367567cf8294605fcc831037a9bb}


\-Implements \hyperlink{classBaseSquadTask_a7c1d1bcd0976b361720ddbea1adc533e}{\-Base\-Squad\-Task}.



\-Definition at line 33 of file \-Default\-Squad.\-h.



\-References m\-Units, and \-Unit\-Group\-::size().


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


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


\hypertarget{classDefaultSquadTask_a9e4a947f5e26d4ff41dae3217462a1a8}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-End\-Location@{get\-End\-Location}}
\index{get\-End\-Location@{get\-End\-Location}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-End\-Location}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Position} {\bf \-Default\-Squad\-Task\-::get\-End\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_a9e4a947f5e26d4ff41dae3217462a1a8}


\-Implements \hyperlink{classBaseSquadTask_ae17b3c1f46cee12cb569e3e52ed6ee23}{\-Base\-Squad\-Task}.



\-Definition at line 37 of file \-Default\-Squad.\-cpp.


\begin{DoxyCode}
{
        return unit->getPosition();
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_a1e67d1b996ed63de757a48fecd472da5}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-End\-Time@{get\-End\-Time}}
\index{get\-End\-Time@{get\-End\-Time}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-End\-Time}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Default\-Squad\-Task\-::get\-End\-Time} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_a1e67d1b996ed63de757a48fecd472da5}


\-Implements \hyperlink{classBaseSquadTask_add66e3f4b4afb54fc0a08d55fd19c2db}{\-Base\-Squad\-Task}.



\-Definition at line 17 of file \-Default\-Squad.\-cpp.



\-References \-Requirement\-::max\-Time.


\begin{DoxyCode}
{
        return Requirement::maxTime;
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_a2bd72d82d7852613c41e50245ea015c6}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-End\-Time@{get\-End\-Time}}
\index{get\-End\-Time@{get\-End\-Time}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-End\-Time}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Default\-Squad\-Task\-::get\-End\-Time} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_a2bd72d82d7852613c41e50245ea015c6}


\-Implements \hyperlink{classBaseSquadTask_a21afb9ae0447a604bf4ff0a1834dcc3d}{\-Base\-Squad\-Task}.



\-Definition at line 22 of file \-Default\-Squad.\-cpp.



\-References \-Requirement\-::max\-Time.


\begin{DoxyCode}
{
        return Requirement::maxTime;
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_a89181f536798d91b4c23c10fecbe141d}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-Finished\-Units@{get\-Finished\-Units}}
\index{get\-Finished\-Units@{get\-Finished\-Units}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-Finished\-Units}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group} {\bf \-Default\-Squad\-Task\-::get\-Finished\-Units} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_a89181f536798d91b4c23c10fecbe141d}


\-Implements \hyperlink{classBaseSquadTask_aff3584b53267b105829931b3ab326d6d}{\-Base\-Squad\-Task}.



\-Definition at line 297 of file \-Default\-Squad.\-cpp.



\-References m\-Units.


\begin{DoxyCode}
{
        return mUnits;
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_af1c9a5f92bf99572e40ec0036351654f}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-Output\-Name@{get\-Output\-Name}}
\index{get\-Output\-Name@{get\-Output\-Name}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-Output\-Name}]{\setlength{\rightskip}{0pt plus 5cm}virtual std\-::string {\bf \-Default\-Squad\-Task\-::get\-Output\-Name} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classDefaultSquadTask_af1c9a5f92bf99572e40ec0036351654f}


\-Implements \hyperlink{classBaseSquadTask_a1d9d5d0ab94bd3dc78f977fb224fe7a5}{\-Base\-Squad\-Task}.



\-Definition at line 31 of file \-Default\-Squad.\-h.


\begin{DoxyCode}
{ return ""; }
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_a7dc43f08fd55ddd347d92d2cdee32af7}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-Priority@{get\-Priority}}
\index{get\-Priority@{get\-Priority}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-Priority}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Default\-Squad\-Task\-::get\-Priority} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_a7dc43f08fd55ddd347d92d2cdee32af7}


\-Implements \hyperlink{classBaseSquadTask_ae32a9a20d95ec82c3e31ba1085690731}{\-Base\-Squad\-Task}.



\-Definition at line 27 of file \-Default\-Squad.\-cpp.


\begin{DoxyCode}
{
        return unit->getType().isWorker() ? 5 : 20;
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_aad04bb453d983cff6ce66b0de75c5864}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-Start\-Location@{get\-Start\-Location}}
\index{get\-Start\-Location@{get\-Start\-Location}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-Start\-Location}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Position} {\bf \-Default\-Squad\-Task\-::get\-Start\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_aad04bb453d983cff6ce66b0de75c5864}


\-Implements \hyperlink{classBaseSquadTask_a2a13fe2d5a0ea4533a6aeed0e49cd513}{\-Base\-Squad\-Task}.



\-Definition at line 32 of file \-Default\-Squad.\-cpp.


\begin{DoxyCode}
{
        return unit->getPosition();
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_ab208d241714ecda7f6b44f8b753fd6d7}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!get\-Task\-Name@{get\-Task\-Name}}
\index{get\-Task\-Name@{get\-Task\-Name}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{get\-Task\-Name}]{\setlength{\rightskip}{0pt plus 5cm}virtual std\-::string {\bf \-Default\-Squad\-Task\-::get\-Task\-Name} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classDefaultSquadTask_ab208d241714ecda7f6b44f8b753fd6d7}


\-Implements \hyperlink{classBaseSquadTask_a6f0014a8e6cb4c62d0d326911bf8da81}{\-Base\-Squad\-Task}.



\-Definition at line 30 of file \-Default\-Squad.\-h.


\begin{DoxyCode}
{ return "Default Squad"; }
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_ac21ce4927c39835c7ffc3350f8d52505}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!give\-Unit@{give\-Unit}}
\index{give\-Unit@{give\-Unit}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{give\-Unit}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Default\-Squad\-Task\-::give\-Unit} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_ac21ce4927c39835c7ffc3350f8d52505}


\-Implements \hyperlink{classBaseSquadTask_a2476febd641eada31d338a8e0e3f2d66}{\-Base\-Squad\-Task}.



\-Definition at line 271 of file \-Default\-Squad.\-cpp.



\-References \-Unit\-Group\-::insert(), m\-Observer, m\-Unit\-Behaviours, m\-Units, and \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Observer.


\begin{DoxyCode}
{
        if(unit->getType() == BWAPI::UnitTypes::Protoss_Observer)
                mObserver = unit;
        
        mUnits.insert(unit);

        mUnitBehaviours[unit] = Behaviour(unit);
}
\end{DoxyCode}


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


\hypertarget{classDefaultSquadTask_aa62784b2aebabc27b3c91ec8fabe82f5}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!morph@{morph}}
\index{morph@{morph}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{morph}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Default\-Squad\-Task\-::morph} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Unit\-Type}}]{previous\-Type}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_aa62784b2aebabc27b3c91ec8fabe82f5}


\-Implements \hyperlink{classBaseSquadTask_a04e71df2d72163d9ce895460f2944114}{\-Base\-Squad\-Task}.



\-Definition at line 292 of file \-Default\-Squad.\-cpp.


\begin{DoxyCode}
{
        return false;
}
\end{DoxyCode}
\hypertarget{classDefaultSquadTask_af5ac92ec1117cc964923dad21a020c5d}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!pre\-Update@{pre\-Update}}
\index{pre\-Update@{pre\-Update}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{pre\-Update}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Default\-Squad\-Task\-::pre\-Update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_af5ac92ec1117cc964923dad21a020c5d}


\-Implements \hyperlink{classBaseSquadTask_a28f5ba462879018fd5f9ff515cde1831}{\-Base\-Squad\-Task}.



\-Definition at line 42 of file \-Default\-Squad.\-cpp.



\-References \-Task\-::has\-Ended(), and update\-Requirements().


\begin{DoxyCode}
{
        updateRequirements();

        return hasEnded();
}
\end{DoxyCode}


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


\hypertarget{classDefaultSquadTask_afba164784df13426e7162862b7c60e9f}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!return\-Unit@{return\-Unit}}
\index{return\-Unit@{return\-Unit}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{return\-Unit}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Default\-Squad\-Task\-::return\-Unit} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_afba164784df13426e7162862b7c60e9f}


\-Implements \hyperlink{classBaseSquadTask_a40abaa603b64db41adda1e7954b71d0b}{\-Base\-Squad\-Task}.



\-Definition at line 281 of file \-Default\-Squad.\-cpp.



\-References \-Unit\-Group\-::erase(), m\-Observer, m\-Unit\-Behaviours, m\-Units, and \-Static\-Units\-::nullunit.


\begin{DoxyCode}
{
        mUnits.erase(unit);

        mUnitBehaviours[unit].onDeleted();
        mUnitBehaviours.erase(unit);

        if(unit == mObserver)
                mObserver = StaticUnits::nullunit;
}
\end{DoxyCode}


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


\hypertarget{classDefaultSquadTask_aac23b08605888316ae02b3cb87399d93}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!update@{update}}
\index{update@{update}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Default\-Squad\-Task\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_aac23b08605888316ae02b3cb87399d93}


\-Implements \hyperlink{classBaseSquadTask_a3bbed4ea7b3369947da610102db52d57}{\-Base\-Squad\-Task}.



\-Definition at line 66 of file \-Default\-Squad.\-cpp.



\-References \-Army\-Behaviour\-Def\-::\-Aggresive, \-Action\-Type\-Def\-::\-Attack, \-Goal\-Type\-Def\-::\-Base, \-B\-W\-A\-P\-I\-::\-Broodwar, \-Unit\-Group\-::can\-Majority\-Attack(), \-Action\-Type\-Def\-::\-Defend, \-Position\-Type\-Def\-::\-Defense\-Chokepoint, \-Unit\-Group\-::empty(), \-Goal\-::get\-Action\-Type(), \-Goal\-::get\-Base(), \-B\-W\-A\-P\-I\-::\-Player\-::get\-Force(), \-Goal\-::get\-Goal\-Type(), get\-Largest\-Choke(), \-Task\-::has\-Ended(), \-Action\-Type\-Def\-::\-Hold, \-Singleton$<$ T $>$\-::\-Instance(), \-Unit\-Group\-::is\-Any\-In\-Range(), \-Unit\-Helper\-::is\-Static\-Defense(), \-Unit\-Group\-::is\-Worth\-Engaging(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Types\-::\-Leg\-\_\-\-Enhancements, \-Access\-Type\-Def\-::\-Lost, \-Base\-Squad\-Task\-::m\-Army\-Behaviour, \-Border\-Position\-::m\-Choke, m\-Engage\-Full, \-Unit\-Group\-::min\-Distance\-Between(), m\-Last\-Goal, m\-Unit\-Behaviours, m\-Units, \-Goal\-Type\-Def\-::\-None, \-B\-W\-A\-P\-I\-::\-Bullet\-Types\-::\-None, \-Unit\-Group\-::rating\-Difference(), \-B\-W\-A\-P\-I\-::\-Game\-::self(), \-Unit\-Group\-::size(), \-B\-W\-A\-P\-I\-::\-Player\-::supply\-Used(), \-B\-W\-A\-P\-I\-::\-Tech\-Types\-::\-Tank\-\_\-\-Siege\-\_\-\-Mode, \-Position\-Type\-Def\-::\-Tech\-Defense\-Chokepoint, \-State\-Type\-Def\-::\-Tech\-High, and \-B\-W\-A\-P\-I\-::\-Races\-::\-Terran.


\begin{DoxyCode}
{
        Goal squadsGoal;

        // Just attack if its not mining anywhere
        bool hasMiningBases = false;
        int techStructures = 0;
        Base baseToDefend;
        bool baseUnderAttack = false;
        const int mySupply = BWAPI::Broodwar->self()->supplyUsed();
        for each(Base base in BaseTracker::Instance().getPlayerBases())
        {
                const int techBuildings = base->getNumberOfTechBuildings();
                if(!base->getEnemyThreats().empty() && (techBuildings > 0 || (!
      base->isMinedOut() && base->getResourceDepot())))
                {
                        bool thisUnderAttack = base->isUnderAttack();
                        if((thisUnderAttack && !baseUnderAttack) || (
      thisUnderAttack == baseUnderAttack && techBuildings > techStructures))
                        {
                                baseUnderAttack = thisUnderAttack;
                                baseToDefend = base;
                                techStructures = techBuildings;
                        }
                }

                if(!base->getMinerals().empty() && base->getResourceDepot() && 
      base->getResourceDepot()->exists())
                        hasMiningBases = true;
        }

        UnitGroup avoidGroup;
        UnitGroup engageGroup;
        for each(const UnitGroup &unitGroup in PlayerTracker::Instance().
      getEnemyClusters())
        {
                if(!hasMiningBases && mUnits.canMajorityAttack(unitGroup))
                {
                        engageGroup += unitGroup;
                        continue;
                }

                if(mUnits.minDistanceBetween(unitGroup) > 540)
                        continue;

                const int rating = mUnits.ratingDifference(unitGroup);
                if(mySupply < 360 && ((!mEngageFull && rating < -350) || rating
       < -1000))
                        avoidGroup += unitGroup;
                else if(mUnits.canMajorityAttack(unitGroup) && (mUnits.
      isWorthEngaging(unitGroup) || unitGroup.isAnyInRange(mUnits)))
                        engageGroup += unitGroup;
        }

        mEngageFull = !engageGroup.empty();
        if(mEngageFull)
                squadsGoal = Goal(ActionType::Attack, engageGroup, avoidGroup);
        else if(baseUnderAttack)
        {
                const int rating = mUnits.ratingDifference(baseToDefend->
      getEnemyThreats());
                if(rating >= 0 || (rating > -1000 && baseUnderAttack))
                        squadsGoal = Goal(ActionType::Defend, baseToDefend->
      getEnemyThreats(), avoidGroup);
        }

        if(squadsGoal.getGoalType() == GoalType::None)
        {
                for each(Base base in BaseTracker::Instance().getPlayerBases())
                {
                        if(base->isContested())
                        {
                                for each(Unit building in base->getBuildings())
                                {
                                        if(BWAPI::Broodwar->self()->isEnemy(
      building->getPlayer()))
                                        {
                                                squadsGoal = Goal(
      ActionType::Attack, building, engageGroup, avoidGroup);
                                                break;
                                        }
                                }
                        }

                        if(squadsGoal.getGoalType() != GoalType::None)
                                break;
                }
        }

        if(squadsGoal.getGoalType() == GoalType::None)
        {
                int enemyKnownSupply = 0;
                int enemyGuessSupply = 0;

                for each(Unit unit in UnitTracker::Instance().selectAllEnemy())
                {
                        int supply = unit->getType().supplyRequired();
                        if(UnitHelper::isStaticDefense(unit->getType()))
                                supply = 7;

                        if(unit->accessibility() != AccessType::Lost)
                                enemyKnownSupply += supply;

                        enemyGuessSupply += supply;
                }

                int alliesSize = 1;
                std::map<BWAPI::Force*, int> enemyForces;
                for each(Player player in BWAPI::Broodwar->getPlayers())
                {
                        if(player == BWAPI::Broodwar->self())
                                continue;

                        if(BWAPI::Broodwar->self()->isAlly(player))
                                ++alliesSize;

                        if(BWAPI::Broodwar->self()->isEnemy(player))
                                ++enemyForces[player->getForce()];
                }

                int maxEnemiesSize = 0;
                for each(std::pair<BWAPI::Force*, int> force in enemyForces)
                {
                        if(force.second > maxEnemiesSize)
                                maxEnemiesSize = force.second;
                }

                bool shouldAttackBase = !hasMiningBases;
                if(mUnits.size() >= 3)
                {
                        if(mySupply > 380)
                                shouldAttackBase = true;
                        else if(GameProgressDetection::Instance().getState() !=
       StateType::TechHigh)
                        {
                                // If its a terran with siege tanks don't
       attack a base without leg speed and also ensure we are better matched as siege tanks
       can hurt
                                bool isTerranWithSiege = PlayerTracker::Instance
      ().isEnemyRace(BWAPI::Races::Terran) && PlayerTracker::Instance().
      enemyHasReseached(BWAPI::TechTypes::Tank_Siege_Mode);
                                if(isTerranWithSiege && BWAPI::Broodwar->self()
      ->getUpgradeLevel(BWAPI::UpgradeTypes::Leg_Enhancements) > 0 && mUnits.size() > 
      45 && mySupply > (enemyGuessSupply * 4))
                                        shouldAttackBase = true;
                                else if(!isTerranWithSiege && mUnits.size() > 
      35 && mySupply > (enemyKnownSupply * 4))
                                        shouldAttackBase = true;
                                else if(mArmyBehaviour <= 
      ArmyBehaviour::Aggresive)
                                {
                                        if(maxEnemiesSize <= alliesSize)
                                                shouldAttackBase = true;
                                }

                                // Agains't weak opponents it can usually
       attack when these pass
                                // how ever against stronger opponents, or
       terran with siege tanks it will just lose a few units time and again then lose to a
       push
                                // easier to just sit back and turtle alittle
                                /*else if(mArmyBehaviour <=
       ArmyBehaviour::Default)
                                {
                                        if(mySupply > (enemyGuessSupply * 4))
                                                shouldAttackBase = true;
                                }
                                else if(mArmyBehaviour ==
       ArmyBehaviour::Defensive)
                                {
                                        if(mySupply > (enemyGuessSupply * 5))
                                                shouldAttackBase = true;
                                }*/
                        }
                }

                if(shouldAttackBase)
                {
                        Base bestBaseToAttack;
                        if(mLastGoal.getGoalType() == GoalType::Base && 
      mLastGoal.getActionType() == ActionType::Attack && mLastGoal.getBase()->
      isEnemyBase())
                                bestBaseToAttack = mLastGoal.getBase();

                        for each(Base base in BaseTracker::Instance().
      getEnemyBases())
                        {
                                if(!bestBaseToAttack || base->getBuildings().
      size() < bestBaseToAttack->getBuildings().size())
                                        bestBaseToAttack = base;
                        }

                        if(bestBaseToAttack)
                                squadsGoal = Goal(ActionType::Attack, 
      bestBaseToAttack, engageGroup, avoidGroup);
                }
        }

        if(squadsGoal.getGoalType() == GoalType::None && baseToDefend && mUnits
      .canMajorityAttack(baseToDefend->getEnemyThreats()))
                squadsGoal = Goal(ActionType::Defend, baseToDefend->
      getCenterLocation(), engageGroup, avoidGroup);

        if(squadsGoal.getGoalType() == GoalType::None)
        {
                if(!BorderTracker::Instance().getBorderPositions(
      PositionType::TechDefenseChokepoint).empty())
                        squadsGoal = Goal(ActionType::Hold, getLargestChoke(
      BorderTracker::Instance().getBorderPositions(PositionType::TechDefenseChokepoint
      )).mChoke->getCenter(), engageGroup, avoidGroup);
        }

        if(squadsGoal.getGoalType() == GoalType::None)
        {
                if(!BorderTracker::Instance().getBorderPositions(
      PositionType::DefenseChokepoint).empty())
                        squadsGoal = Goal(ActionType::Hold, getLargestChoke(
      BorderTracker::Instance().getBorderPositions(PositionType::DefenseChokepoint)).
      mChoke->getCenter(), engageGroup, avoidGroup);
        }

        if(squadsGoal.getGoalType() == GoalType::None)
                squadsGoal = Goal(ActionType::Attack, Position(BWAPI::Broodwar-
      >mapWidth()*24, BWAPI::Broodwar->mapHeight()*16), engageGroup, avoidGroup);

        if(!mEngageFull && !avoidGroup.empty() && squadsGoal.getActionType() ==
       ActionType::Attack && squadsGoal.getGoalType() == GoalType::Base)
                squadsGoal = Goal(ActionType::Attack, avoidGroup.getCenter(), 
      engageGroup, avoidGroup);

        mLastGoal = squadsGoal;
        if(squadsGoal.getGoalType() != GoalType::None)
        {
                for(std::map<Unit, Behaviour>::iterator it = mUnitBehaviours.
      begin(); it != mUnitBehaviours.end(); ++it)
                        it->second.update(squadsGoal, mUnits);
        }

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


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


\hypertarget{classDefaultSquadTask_a8d73560f1b84f6089747285805e5ab28}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!update\-Requirements@{update\-Requirements}}
\index{update\-Requirements@{update\-Requirements}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{update\-Requirements}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Default\-Squad\-Task\-::update\-Requirements} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_a8d73560f1b84f6089747285805e5ab28}


\-Reimplemented from \hyperlink{classBaseSquadTask_a22d39149694ddf1c8810e3137e7ccfd8}{\-Base\-Squad\-Task}.



\-Definition at line 302 of file \-Default\-Squad.\-cpp.



\-References \-Task\-::add\-Requirement(), \-Requirement\-Group\-::add\-Unit\-Filter\-Requirement(), \-Requirement\-Group\-::add\-Unit\-Requirement(), \-B\-W\-A\-P\-I\-::\-Broodwar, \-Task\-::clear\-Requirements(), \-Unit\-Group\-::count(), \-Task\-::has\-Ended(), \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Addon(), \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Building(), \-Unit\-Filter\-Flags\-::\-Is\-Complete, \-B\-W\-A\-P\-I\-::\-Unit\-Type\-::is\-Worker(), \-Requirement\-::max\-Time, m\-Observer, m\-Units, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Interceptor, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Observer, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Protoss\-\_\-\-Scarab, \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Zerg\-\_\-\-Egg, and \-B\-W\-A\-P\-I\-::\-Unit\-Types\-::\-Zerg\-\_\-\-Larva.



\-Referenced by pre\-Update().


\begin{DoxyCode}
{
        clearRequirements();

        if(!hasEnded())
        {
                for each(Unit unit in UnitTracker::Instance().selectAllUnits())
                {
                        if(!unit->isCompleted())
                                continue;

                        if(mUnits.count(unit) != 0)
                                continue;

                        const BWAPI::UnitType &type = unit->getType();
                        if(type.isBuilding())
                                continue;
                        if(type.isAddon())
                                continue;
                        if(type == BWAPI::Broodwar->self()->getRace().
      getSupplyProvider())
                                continue;
                        if(type == BWAPI::UnitTypes::Zerg_Egg)
                                continue;
                        if(type == BWAPI::UnitTypes::Protoss_Interceptor)
                                continue;
                        if(type == BWAPI::UnitTypes::Zerg_Larva)
                                continue;
                        if(type == BWAPI::UnitTypes::Protoss_Scarab)
                                continue;
                        if(type == BWAPI::UnitTypes::Protoss_Observer)
                                continue;

                        RequirementGroup req;

                        req.addUnitRequirement(unit, type.isWorker() ? 5 : 20, 
      Requirement::maxTime);

                        addRequirement(req);
                }

                if(!mObserver)
                {
                        RequirementGroup req;

                        req.addUnitFilterRequirement(20, Requirement::maxTime, 
      UnitFilter(BWAPI::UnitTypes::Protoss_Observer) && UnitFilter(
      UnitFilterFlags::IsComplete));

                        addRequirement(req);
                }
        }
}\end{DoxyCode}


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




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


\hypertarget{classDefaultSquadTask_aed5fa264e814ccab3c3ebe0fd1d5f072}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!waiting\-For\-Unit@{waiting\-For\-Unit}}
\index{waiting\-For\-Unit@{waiting\-For\-Unit}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{waiting\-For\-Unit}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Default\-Squad\-Task\-::waiting\-For\-Unit} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classDefaultSquadTask_aed5fa264e814ccab3c3ebe0fd1d5f072}


\-Implements \hyperlink{classBaseSquadTask_a6f5969e4520a4fd0db2ce8dd7dc2c4d0}{\-Base\-Squad\-Task}.



\-Definition at line 266 of file \-Default\-Squad.\-cpp.


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


\subsection{\-Member \-Data \-Documentation}
\hypertarget{classDefaultSquadTask_a248fde85d2ecb8d858c068c2fe4e818b}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!m\-Engage\-Full@{m\-Engage\-Full}}
\index{m\-Engage\-Full@{m\-Engage\-Full}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{m\-Engage\-Full}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Default\-Squad\-Task\-::m\-Engage\-Full}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classDefaultSquadTask_a248fde85d2ecb8d858c068c2fe4e818b}


\-Definition at line 44 of file \-Default\-Squad.\-h.



\-Referenced by update().

\hypertarget{classDefaultSquadTask_a0a5e791ebb31eabdc9746d9208f03d82}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!m\-Last\-Goal@{m\-Last\-Goal}}
\index{m\-Last\-Goal@{m\-Last\-Goal}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{m\-Last\-Goal}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Goal} {\bf \-Default\-Squad\-Task\-::m\-Last\-Goal}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classDefaultSquadTask_a0a5e791ebb31eabdc9746d9208f03d82}


\-Definition at line 43 of file \-Default\-Squad.\-h.



\-Referenced by update().

\hypertarget{classDefaultSquadTask_a32b20a7becaa6d48e1f5b878a3f6ea64}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!m\-Observer@{m\-Observer}}
\index{m\-Observer@{m\-Observer}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{m\-Observer}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Default\-Squad\-Task\-::m\-Observer}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classDefaultSquadTask_a32b20a7becaa6d48e1f5b878a3f6ea64}


\-Definition at line 41 of file \-Default\-Squad.\-h.



\-Referenced by give\-Unit(), return\-Unit(), and update\-Requirements().

\hypertarget{classDefaultSquadTask_a4e3282fa4077597b348ff567e0c817a0}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!m\-Unit\-Behaviours@{m\-Unit\-Behaviours}}
\index{m\-Unit\-Behaviours@{m\-Unit\-Behaviours}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{m\-Unit\-Behaviours}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Unit}, {\bf \-Behaviour}$>$ {\bf \-Default\-Squad\-Task\-::m\-Unit\-Behaviours}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classDefaultSquadTask_a4e3282fa4077597b348ff567e0c817a0}


\-Definition at line 39 of file \-Default\-Squad.\-h.



\-Referenced by give\-Unit(), return\-Unit(), and update().

\hypertarget{classDefaultSquadTask_a1fa8d895c8e7b97b89428d2e4872e1e5}{\index{\-Default\-Squad\-Task@{\-Default\-Squad\-Task}!m\-Units@{m\-Units}}
\index{m\-Units@{m\-Units}!DefaultSquadTask@{\-Default\-Squad\-Task}}
\subsubsection[{m\-Units}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group} {\bf \-Default\-Squad\-Task\-::m\-Units}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classDefaultSquadTask_a1fa8d895c8e7b97b89428d2e4872e1e5}


\-Definition at line 38 of file \-Default\-Squad.\-h.



\-Referenced by control\-Size(), get\-Finished\-Units(), give\-Unit(), return\-Unit(), update(), and update\-Requirements().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{DefaultSquad_8h}{\-Default\-Squad.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{DefaultSquad_8cpp}{\-Default\-Squad.\-cpp}\end{DoxyCompactItemize}
