\hypertarget{classGatherTask}{\section{\-Gather\-Task \-Class \-Reference}
\label{classGatherTask}\index{\-Gather\-Task@{\-Gather\-Task}}
}


{\ttfamily \#include $<$\-Gather\-Task.\-h$>$}



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


\-Collaboration diagram for \-Gather\-Task\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=550pt]{classGatherTask__coll__graph}
\end{center}
\end{figure}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classGatherTask_a07907070247e168ca082b18251b478da}{\-Gather\-Task} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} resource, \hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} base)
\item 
virtual int \hyperlink{classGatherTask_a16af11b86486a670496cf3ff20e65ce7}{get\-End\-Time} () const 
\item 
virtual int \hyperlink{classGatherTask_aa3414b0b939df4f7077012933d285548}{get\-End\-Time} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual int \hyperlink{classGatherTask_a037a7db0fe59dd02662c2007f8c1d56f}{get\-Priority} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classGatherTask_aab9a1317865098de9c85e745abe94878}{get\-Start\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classGatherTask_a8423b88196bdde53c949b8b8e118990b}{get\-End\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual bool \hyperlink{classGatherTask_ae6b9a0e57139d5182314af732fb89b02}{pre\-Update} ()
\item 
virtual bool \hyperlink{classGatherTask_a81bef74d414dd008d7b9a299b651eb80}{update} ()
\item 
virtual void \hyperlink{classGatherTask_a050adfc311ac74273ffde1ab008898bf}{update\-Requirements} ()
\item 
virtual bool \hyperlink{classGatherTask_a6a8c84922edb12ee3162a235bf036f6f}{waiting\-For\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual void \hyperlink{classGatherTask_a32fe9e8ce0f4c25bfbd7e8130ecee49c}{give\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
virtual void \hyperlink{classGatherTask_a91d3de0a2bd35147abd1bf249454b8d8}{return\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
virtual bool \hyperlink{classGatherTask_a87b77701fbf423ff5840694ae51c705c}{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{classGatherTask_af5f8543964ee4e16122f095853d08c15}{get\-Finished\-Units} ()
\item 
virtual std\-::string \hyperlink{classGatherTask_a4aea30c666288b2f7958fcdfafa4209d}{get\-Task\-Name} () const 
\item 
virtual std\-::string \hyperlink{classGatherTask_a344a19529391a49f786379825e515121}{get\-Output\-Name} () const 
\item 
double \hyperlink{classGatherTask_ae9de23fe57883c73444cdbdff9e37e50}{get\-Mineral\-Rate} ()
\item 
double \hyperlink{classGatherTask_a353870dbeaa54668ac2f07e228aee986}{get\-Gas\-Rate} ()
\end{DoxyCompactItemize}
\subsection*{\-Private \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{classGatherTask_ac214688fa049bd7773fea06ac4ad90cb}{update\-Worker} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} worker)
\item 
int \hyperlink{classGatherTask_a9998ebacb29498ab4384d464f2753610}{worker\-Priority} (int worker\-Number) const 
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
\hyperlink{Base_8h_aeee60104d9f1947526194ec22d997f69}{\-Base} \hyperlink{classGatherTask_a53f1326b57fcf109cfcec946da71ad2c}{m\-Base}
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classGatherTask_a76aedb50d3fd33b29629ae4c97d0b1ba}{m\-Resource}
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classGatherTask_a08ca149fd17fd72c6a6d0c3c671b5395}{m\-Worker\-One}
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classGatherTask_a257baa8650779cf243dae7963c0f40ef}{m\-Worker\-Two}
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classGatherTask_a29f9cd70705cd187da9f7c1be76e64a5}{m\-Worker\-Three}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 8 of file \-Gather\-Task.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classGatherTask_a07907070247e168ca082b18251b478da}{\index{\-Gather\-Task@{\-Gather\-Task}!\-Gather\-Task@{\-Gather\-Task}}
\index{\-Gather\-Task@{\-Gather\-Task}!GatherTask@{\-Gather\-Task}}
\subsubsection[{\-Gather\-Task}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Gather\-Task\-::\-Gather\-Task} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{resource, }
\item[{{\bf \-Base}}]{base}
\end{DoxyParamCaption}
)}}\label{classGatherTask_a07907070247e168ca082b18251b478da}


\-Definition at line 5 of file \-Gather\-Task.\-cpp.


\begin{DoxyCode}
        : Task(TaskType::Medium)
        , mResource(resource)
        , mBase(base)
{
}
\end{DoxyCode}


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classGatherTask_a8423b88196bdde53c949b8b8e118990b}{\index{\-Gather\-Task@{\-Gather\-Task}!get\-End\-Location@{get\-End\-Location}}
\index{get\-End\-Location@{get\-End\-Location}!GatherTask@{\-Gather\-Task}}
\subsubsection[{get\-End\-Location}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Position} {\bf \-Gather\-Task\-::get\-End\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classGatherTask_a8423b88196bdde53c949b8b8e118990b}


\-Implements \hyperlink{classTask_ae1c96f2085a7126fb0baf5f039caeee4}{\-Task}.



\-Definition at line 27 of file \-Gather\-Task.\-cpp.


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


\-Implements \hyperlink{classTask_a2d89c4f298ec499a3ecc02c45c361f41}{\-Task}.



\-Definition at line 12 of file \-Gather\-Task.\-cpp.



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



\-Referenced by get\-End\-Time().


\begin{DoxyCode}
{
        return Requirement::maxTime;
}
\end{DoxyCode}


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


\hypertarget{classGatherTask_aa3414b0b939df4f7077012933d285548}{\index{\-Gather\-Task@{\-Gather\-Task}!get\-End\-Time@{get\-End\-Time}}
\index{get\-End\-Time@{get\-End\-Time}!GatherTask@{\-Gather\-Task}}
\subsubsection[{get\-End\-Time}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Gather\-Task\-::get\-End\-Time} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classGatherTask_aa3414b0b939df4f7077012933d285548}


\-Implements \hyperlink{classTask_afba4a0f2a63ee2bd30b29bee33324982}{\-Task}.



\-Definition at line 17 of file \-Gather\-Task.\-cpp.



\-References get\-End\-Time().


\begin{DoxyCode}
{
        return getEndTime();
}
\end{DoxyCode}


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


\hypertarget{classGatherTask_af5f8543964ee4e16122f095853d08c15}{\index{\-Gather\-Task@{\-Gather\-Task}!get\-Finished\-Units@{get\-Finished\-Units}}
\index{get\-Finished\-Units@{get\-Finished\-Units}!GatherTask@{\-Gather\-Task}}
\subsubsection[{get\-Finished\-Units}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit\-Group} {\bf \-Gather\-Task\-::get\-Finished\-Units} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classGatherTask_af5f8543964ee4e16122f095853d08c15}


\-Implements \hyperlink{classTask_af44e192b780e39d89c79f40d92a1e2a8}{\-Task}.



\-Definition at line 97 of file \-Gather\-Task.\-cpp.



\-References \-Unit\-Group\-::insert(), m\-Worker\-One, m\-Worker\-Three, and m\-Worker\-Two.


\begin{DoxyCode}
{
        UnitGroup returnUnits;

        if(mWorkerOne)
                returnUnits.insert(mWorkerOne);
        if(mWorkerTwo)
                returnUnits.insert(mWorkerTwo);
        if(mWorkerThree)
                returnUnits.insert(mWorkerThree);

        return returnUnits;
}
\end{DoxyCode}


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


\hypertarget{classGatherTask_a353870dbeaa54668ac2f07e228aee986}{\index{\-Gather\-Task@{\-Gather\-Task}!get\-Gas\-Rate@{get\-Gas\-Rate}}
\index{get\-Gas\-Rate@{get\-Gas\-Rate}!GatherTask@{\-Gather\-Task}}
\subsubsection[{get\-Gas\-Rate}]{\setlength{\rightskip}{0pt plus 5cm}double {\bf \-Gather\-Task\-::get\-Gas\-Rate} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classGatherTask_a353870dbeaa54668ac2f07e228aee986}


\-Definition at line 197 of file \-Gather\-Task.\-cpp.



\-References m\-Resource, m\-Worker\-One, m\-Worker\-Three, and m\-Worker\-Two.


\begin{DoxyCode}
{
        if(!mResource->getType().isRefinery())
                return 0.0;

        if(mWorkerThree)
                return 3 * 8/180.0;

        if(mWorkerTwo)
                return 2 * 8/180.0;

        if(mWorkerOne)
                return 8/180.0;

        return 0.0;
}
\end{DoxyCode}
\hypertarget{classGatherTask_ae9de23fe57883c73444cdbdff9e37e50}{\index{\-Gather\-Task@{\-Gather\-Task}!get\-Mineral\-Rate@{get\-Mineral\-Rate}}
\index{get\-Mineral\-Rate@{get\-Mineral\-Rate}!GatherTask@{\-Gather\-Task}}
\subsubsection[{get\-Mineral\-Rate}]{\setlength{\rightskip}{0pt plus 5cm}double {\bf \-Gather\-Task\-::get\-Mineral\-Rate} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classGatherTask_ae9de23fe57883c73444cdbdff9e37e50}


\-Definition at line 180 of file \-Gather\-Task.\-cpp.



\-References m\-Resource, m\-Worker\-One, m\-Worker\-Three, and m\-Worker\-Two.


\begin{DoxyCode}
{
        if(mResource->getType().isRefinery())
                return 0.0;

        if(mWorkerThree)
                return 3 * 8/180.0;

        if(mWorkerTwo)
                return 2 * 8/180.0;

        if(mWorkerOne)
                return 8/180.0;

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


\-Implements \hyperlink{classTask_ad6349b722f8dd48bcde4020d225d047b}{\-Task}.



\-Definition at line 33 of file \-Gather\-Task.\-h.



\-References m\-Resource.


\begin{DoxyCode}
{ return mResource->getType().getName(); }
\end{DoxyCode}
\hypertarget{classGatherTask_a037a7db0fe59dd02662c2007f8c1d56f}{\index{\-Gather\-Task@{\-Gather\-Task}!get\-Priority@{get\-Priority}}
\index{get\-Priority@{get\-Priority}!GatherTask@{\-Gather\-Task}}
\subsubsection[{get\-Priority}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Gather\-Task\-::get\-Priority} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classGatherTask_a037a7db0fe59dd02662c2007f8c1d56f}


\-Implements \hyperlink{classTask_a01453612cced63eaf9e8c1de24742415}{\-Task}.



\-Definition at line 111 of file \-Gather\-Task.\-cpp.



\-References m\-Worker\-One, m\-Worker\-Three, m\-Worker\-Two, and worker\-Priority().


\begin{DoxyCode}
{
        if(!mWorkerOne || unit == mWorkerOne)
                return workerPriority(1);
        else if(!mWorkerTwo || unit == mWorkerTwo)
                return workerPriority(2);
        else if(!mWorkerThree || unit == mWorkerThree)
                return workerPriority(3);

        assert(false);
        return 10;
}
\end{DoxyCode}


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


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


\-Implements \hyperlink{classTask_a5b911073755ecca5536db6c73fb85127}{\-Task}.



\-Definition at line 22 of file \-Gather\-Task.\-cpp.


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


\-Implements \hyperlink{classTask_ad188a18386ae1120317eac922228ce18}{\-Task}.



\-Definition at line 32 of file \-Gather\-Task.\-h.


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


\-Implements \hyperlink{classTask_a40f1808c208279c99223c1ce5bc9607d}{\-Task}.



\-Definition at line 59 of file \-Gather\-Task.\-cpp.



\-References m\-Worker\-One, m\-Worker\-Three, and m\-Worker\-Two.


\begin{DoxyCode}
{
        if(!mWorkerOne)
                mWorkerOne = unit;
        else if(!mWorkerTwo)
                mWorkerTwo = unit;
        else if(!mWorkerThree)
                mWorkerThree = unit;
        else
                assert(false);
}
\end{DoxyCode}
\hypertarget{classGatherTask_a87b77701fbf423ff5840694ae51c705c}{\index{\-Gather\-Task@{\-Gather\-Task}!morph@{morph}}
\index{morph@{morph}!GatherTask@{\-Gather\-Task}}
\subsubsection[{morph}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Gather\-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{classGatherTask_a87b77701fbf423ff5840694ae51c705c}


\-Implements \hyperlink{classTask_a084117559b93bfb82c4f6c3b88c6609c}{\-Task}.



\-Definition at line 92 of file \-Gather\-Task.\-cpp.


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


\-Implements \hyperlink{classTask_a3cb1ce7dab90a8a2290381f78b665fe4}{\-Task}.



\-Definition at line 32 of file \-Gather\-Task.\-cpp.



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


\begin{DoxyCode}
{
        if(hasEnded())
                return true;

        updateRequirements();

        return false;
}
\end{DoxyCode}


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


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


\-Implements \hyperlink{classTask_a34a365e54af1b184d43fcbf7a7730696}{\-Task}.



\-Definition at line 71 of file \-Gather\-Task.\-cpp.



\-References m\-Worker\-One, m\-Worker\-Three, m\-Worker\-Two, and \-Static\-Units\-::nullunit.


\begin{DoxyCode}
{
        if(mWorkerOne == unit)
        {
                mWorkerOne = mWorkerTwo;
                mWorkerTwo = mWorkerThree;
                mWorkerThree = StaticUnits::nullunit;
        }
        else if(mWorkerTwo == unit)
        {
                mWorkerTwo = mWorkerThree;
                mWorkerThree = StaticUnits::nullunit;
        }
        else if(mWorkerThree == unit)
        {
                mWorkerThree = StaticUnits::nullunit;
        }
        else
                assert(false);
}
\end{DoxyCode}
\hypertarget{classGatherTask_a81bef74d414dd008d7b9a299b651eb80}{\index{\-Gather\-Task@{\-Gather\-Task}!update@{update}}
\index{update@{update}!GatherTask@{\-Gather\-Task}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Gather\-Task\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classGatherTask_a81bef74d414dd008d7b9a299b651eb80}


\-Implements \hyperlink{classTask_a88e5096a1943df5d72f3329af2bc2562}{\-Task}.



\-Definition at line 42 of file \-Gather\-Task.\-cpp.



\-References \-Task\-::has\-Ended(), m\-Worker\-One, m\-Worker\-Three, m\-Worker\-Two, and update\-Worker().


\begin{DoxyCode}
{
        if(mWorkerOne)
                updateWorker(mWorkerOne);
        if(mWorkerTwo)
                updateWorker(mWorkerTwo);
        if(mWorkerThree)
                updateWorker(mWorkerThree);

        return hasEnded() && !mWorkerOne && !mWorkerTwo && !mWorkerThree;
}
\end{DoxyCode}


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


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


\-Reimplemented from \hyperlink{classTask_a939d9adfef004e349e78d5949ba37dd8}{\-Task}.



\-Definition at line 136 of file \-Gather\-Task.\-cpp.



\-References \-Task\-::add\-Requirement(), \-Requirement\-Group\-::add\-Time\-Requirement(), \-Requirement\-Group\-::add\-Unit\-Filter\-Requirement(), \-Task\-::clear\-Requirements(), \-Unit\-Filter\-Flags\-::\-Is\-Complete, \-Unit\-Filter\-Flags\-::\-Is\-Worker, \-Requirement\-::max\-Time, m\-Base, m\-Resource, m\-Worker\-One, m\-Worker\-Three, m\-Worker\-Two, and worker\-Priority().



\-Referenced by pre\-Update().


\begin{DoxyCode}
{
        clearRequirements();

        //TODO: any worker will do that i can control, dont limit to my races
       workers
        Unit resourceDepot = mBase->getResourceDepot();
        if(resourceDepot)
        {
                int completeTime = 0;
                if(!resourceDepot->isCompleted())
                        completeTime = resourceDepot->getCompletedTime();

                if(mResource->getType().isRefinery() && !mResource->isCompleted
      ())
                        completeTime = std::max(completeTime, mResource->
      getCompletedTime());

                if(!mWorkerOne)
                {
                        RequirementGroup requirementOne;
                        requirementOne.addUnitFilterRequirement(workerPriority(
      1), Requirement::maxTime, UnitFilter(UnitFilterFlags::IsWorker) && UnitFilter(
      UnitFilterFlags::IsComplete), mResource->getPosition());
                        if(completeTime > 0)
                                requirementOne.addTimeRequirement(completeTime)
      ;
                        addRequirement(requirementOne);
                }

                if(!mWorkerTwo)
                {
                        RequirementGroup requirementTwo;
                        requirementTwo.addUnitFilterRequirement(workerPriority(
      2), Requirement::maxTime, UnitFilter(UnitFilterFlags::IsWorker) && UnitFilter(
      UnitFilterFlags::IsComplete), mResource->getPosition());
                        if(completeTime > 0)
                                requirementTwo.addTimeRequirement(completeTime)
      ;
                        addRequirement(requirementTwo);
                }

                if(!mWorkerThree)
                {
                        RequirementGroup requirementThree;
                        requirementThree.addUnitFilterRequirement(workerPriority
      (3), Requirement::maxTime, UnitFilter(UnitFilterFlags::IsWorker) && UnitFilter(
      UnitFilterFlags::IsComplete), mResource->getPosition());
                        if(completeTime > 0)
                                requirementThree.addTimeRequirement(
      completeTime);
                        addRequirement(requirementThree);
                }
        }
}
\end{DoxyCode}


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




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


\hypertarget{classGatherTask_ac214688fa049bd7773fea06ac4ad90cb}{\index{\-Gather\-Task@{\-Gather\-Task}!update\-Worker@{update\-Worker}}
\index{update\-Worker@{update\-Worker}!GatherTask@{\-Gather\-Task}}
\subsubsection[{update\-Worker}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Gather\-Task\-::update\-Worker} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{worker}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_ac214688fa049bd7773fea06ac4ad90cb}


\-Definition at line 124 of file \-Gather\-Task.\-cpp.



\-References m\-Base, and m\-Resource.



\-Referenced by update().


\begin{DoxyCode}
{
        if(worker->isCarryingGas() || worker->isCarryingMinerals())
        {
                Unit resourceDepot = mBase->getResourceDepot();
                if(resourceDepot)
                        worker->returnCargo(resourceDepot);
        }
        else
                worker->gather(mResource);
}
\end{DoxyCode}


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


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


\-Implements \hyperlink{classTask_a173eafb86a3d9d6c148d005f7778361c}{\-Task}.



\-Definition at line 54 of file \-Gather\-Task.\-cpp.


\begin{DoxyCode}
{
        return false;
}
\end{DoxyCode}
\hypertarget{classGatherTask_a9998ebacb29498ab4384d464f2753610}{\index{\-Gather\-Task@{\-Gather\-Task}!worker\-Priority@{worker\-Priority}}
\index{worker\-Priority@{worker\-Priority}!GatherTask@{\-Gather\-Task}}
\subsubsection[{worker\-Priority}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Gather\-Task\-::worker\-Priority} (
\begin{DoxyParamCaption}
\item[{int}]{worker\-Number}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_a9998ebacb29498ab4384d464f2753610}


\-Definition at line 214 of file \-Gather\-Task.\-cpp.



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



\-Referenced by get\-Priority(), and update\-Requirements().


\begin{DoxyCode}
{
        if(mResource->getType().isRefinery())
        {
                int gLevel = ResourceManager::Instance().getGasLevel();
                if(gLevel == 8)
                        return 25;
                else if(workerNumber == 1)
                {
                        if(gLevel > 3)
                                return 25;
                        else if(gLevel > 2)
                                return 20;
                        else if(gLevel > 1)
                                return 15;
                        else if(gLevel > 0)
                                return 10;
                        else
                                return 0;
                }
                else if(workerNumber == 2)
                {
                        if(gLevel > 5)
                                return 25;
                        else if(gLevel > 4)
                                return 20;
                        else if(gLevel > 3)
                                return 15;
                        else if(gLevel > 2)
                                return 10;
                        else
                                return 0;
                }
                else if(workerNumber == 3)
                {
                        if(gLevel > 7)
                                return 25;
                        else if(gLevel > 6)
                                return 20;
                        else if(gLevel > 5)
                                return 15;
                        else if(gLevel > 4)
                                return 10;
                        else
                                return 0;
                }

        }
        else if(workerNumber == 1)
                return 20;
        else if(workerNumber == 2)
                return 15;
        else if(workerNumber == 3)
                return 10;

        return 0;
}\end{DoxyCode}


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




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




\subsection{\-Member \-Data \-Documentation}
\hypertarget{classGatherTask_a53f1326b57fcf109cfcec946da71ad2c}{\index{\-Gather\-Task@{\-Gather\-Task}!m\-Base@{m\-Base}}
\index{m\-Base@{m\-Base}!GatherTask@{\-Gather\-Task}}
\subsubsection[{m\-Base}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Base} {\bf \-Gather\-Task\-::m\-Base}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_a53f1326b57fcf109cfcec946da71ad2c}


\-Definition at line 41 of file \-Gather\-Task.\-h.



\-Referenced by update\-Requirements(), and update\-Worker().

\hypertarget{classGatherTask_a76aedb50d3fd33b29629ae4c97d0b1ba}{\index{\-Gather\-Task@{\-Gather\-Task}!m\-Resource@{m\-Resource}}
\index{m\-Resource@{m\-Resource}!GatherTask@{\-Gather\-Task}}
\subsubsection[{m\-Resource}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Gather\-Task\-::m\-Resource}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_a76aedb50d3fd33b29629ae4c97d0b1ba}


\-Definition at line 42 of file \-Gather\-Task.\-h.



\-Referenced by get\-Gas\-Rate(), get\-Mineral\-Rate(), get\-Output\-Name(), update\-Requirements(), update\-Worker(), and worker\-Priority().

\hypertarget{classGatherTask_a08ca149fd17fd72c6a6d0c3c671b5395}{\index{\-Gather\-Task@{\-Gather\-Task}!m\-Worker\-One@{m\-Worker\-One}}
\index{m\-Worker\-One@{m\-Worker\-One}!GatherTask@{\-Gather\-Task}}
\subsubsection[{m\-Worker\-One}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Gather\-Task\-::m\-Worker\-One}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_a08ca149fd17fd72c6a6d0c3c671b5395}


\-Definition at line 44 of file \-Gather\-Task.\-h.



\-Referenced by get\-Finished\-Units(), get\-Gas\-Rate(), get\-Mineral\-Rate(), get\-Priority(), give\-Unit(), return\-Unit(), update(), and update\-Requirements().

\hypertarget{classGatherTask_a29f9cd70705cd187da9f7c1be76e64a5}{\index{\-Gather\-Task@{\-Gather\-Task}!m\-Worker\-Three@{m\-Worker\-Three}}
\index{m\-Worker\-Three@{m\-Worker\-Three}!GatherTask@{\-Gather\-Task}}
\subsubsection[{m\-Worker\-Three}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Gather\-Task\-::m\-Worker\-Three}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_a29f9cd70705cd187da9f7c1be76e64a5}


\-Definition at line 46 of file \-Gather\-Task.\-h.



\-Referenced by get\-Finished\-Units(), get\-Gas\-Rate(), get\-Mineral\-Rate(), get\-Priority(), give\-Unit(), return\-Unit(), update(), and update\-Requirements().

\hypertarget{classGatherTask_a257baa8650779cf243dae7963c0f40ef}{\index{\-Gather\-Task@{\-Gather\-Task}!m\-Worker\-Two@{m\-Worker\-Two}}
\index{m\-Worker\-Two@{m\-Worker\-Two}!GatherTask@{\-Gather\-Task}}
\subsubsection[{m\-Worker\-Two}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Unit} {\bf \-Gather\-Task\-::m\-Worker\-Two}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classGatherTask_a257baa8650779cf243dae7963c0f40ef}


\-Definition at line 45 of file \-Gather\-Task.\-h.



\-Referenced by get\-Finished\-Units(), get\-Gas\-Rate(), get\-Mineral\-Rate(), get\-Priority(), 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{GatherTask_8h}{\-Gather\-Task.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{GatherTask_8cpp}{\-Gather\-Task.\-cpp}\end{DoxyCompactItemize}
