\hypertarget{classUpgradeTask}{\section{\-Upgrade\-Task \-Class \-Reference}
\label{classUpgradeTask}\index{\-Upgrade\-Task@{\-Upgrade\-Task}}
}


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



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


\-Collaboration diagram for \-Upgrade\-Task\-:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=550pt]{classUpgradeTask__coll__graph}
\end{center}
\end{figure}
\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classUpgradeTask_ab771e8649897b761d4a427765c24e745}{\-Upgrade\-Task} (\hyperlink{Task_8h_a7b31e3712710b22657fc622787547497}{\-Task\-Type} priority, \hyperlink{classBWAPI_1_1UpgradeType}{\-B\-W\-A\-P\-I\-::\-Upgrade\-Type} type, int level)
\item 
virtual int \hyperlink{classUpgradeTask_a53bbd845f5da219411fa47618eb749b4}{get\-End\-Time} () const 
\item 
virtual int \hyperlink{classUpgradeTask_abcdb860b0c72c9655c320f4ac92f9f1a}{get\-End\-Time} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual int \hyperlink{classUpgradeTask_a686e0573a07d17ab0ab085c5751d7338}{get\-Priority} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classUpgradeTask_a732e693f55ac8a88efa62325ee8c8962}{get\-Start\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} \hyperlink{classUpgradeTask_a3797ee5a8500bf7bd0b98b6a2e79bc37}{get\-End\-Location} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual bool \hyperlink{classUpgradeTask_a59ae7874528489ca11e39beeb9833ba5}{pre\-Update} ()
\item 
virtual bool \hyperlink{classUpgradeTask_a1a2d396b384dec70c65822e40026ae84}{update} ()
\item 
virtual void \hyperlink{classUpgradeTask_a7f70021d92051943c43ab5bb1e4cfbf8}{update\-Requirements} ()
\item 
virtual bool \hyperlink{classUpgradeTask_a099a064ee7296700a45226b9228d012b}{waiting\-For\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit) const 
\item 
virtual void \hyperlink{classUpgradeTask_aac56d3490c78f418285de66c04fc5628}{give\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
virtual void \hyperlink{classUpgradeTask_abf230af7a8bc6bc65cfdaa08a8cb5b70}{return\-Unit} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
virtual bool \hyperlink{classUpgradeTask_a191abe971493d30fe6a618c90eae4f12}{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{classUpgradeTask_a83bd25ed05c3799ccf5e48b41ccf0eaf}{get\-Finished\-Units} ()
\item 
virtual std\-::string \hyperlink{classUpgradeTask_a6d6bba0080abc7abf6e2f4482ac93ac5}{get\-Task\-Name} () const 
\item 
virtual std\-::string \hyperlink{classUpgradeTask_a32d32a3fc301e6b74dfc2742a02cbf3f}{get\-Output\-Name} () const 
\item 
virtual void \hyperlink{classUpgradeTask_a8e8e8f04434cbf848a9c93d02672f5c5}{set\-Required\-Satisfy\-Time} (\hyperlink{classRequirementGroup}{\-Requirement\-Group} requirements, int time, int delay)
\item 
virtual int \hyperlink{classUpgradeTask_aeb01a65ed8c28b42e7136638cb0432af}{dispatch\-Time} () const 
\item 
virtual int \hyperlink{classUpgradeTask_a395310788f4966ee851c5e02ae0ec1c4}{start\-Time} () const 
\item 
virtual bool \hyperlink{classUpgradeTask_a21fd78fcfd77ce2c7bb9394719407da6}{has\-Dispatched} () const 
\item 
virtual bool \hyperlink{classUpgradeTask_a38018a3c8a1935546c2760ef39840e2e}{in\-Progress} () const 
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classBWAPI_1_1UpgradeType}{\-B\-W\-A\-P\-I\-::\-Upgrade\-Type} \hyperlink{classUpgradeTask_ae2a81e857c940388f984970fb95df931}{m\-Type}
\item 
int \hyperlink{classUpgradeTask_aba3f1566e59bf76acad0f3d3f9179cb6}{m\-Level}
\item 
\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} \hyperlink{classUpgradeTask_a4f02d01bd8939601e7c8692da5d1c070}{m\-Unit}
\item 
int \hyperlink{classUpgradeTask_ac960540c184f999b5c02b5d00137c403}{m\-Required\-Satisfy\-Time}
\item 
bool \hyperlink{classUpgradeTask_a9b909173e08c72ed7fda2ee14842b6a1}{m\-Reserved\-Resources}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 7 of file \-Upgrade\-Task.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classUpgradeTask_ab771e8649897b761d4a427765c24e745}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!\-Upgrade\-Task@{\-Upgrade\-Task}}
\index{\-Upgrade\-Task@{\-Upgrade\-Task}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{\-Upgrade\-Task}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Upgrade\-Task\-::\-Upgrade\-Task} (
\begin{DoxyParamCaption}
\item[{{\bf \-Task\-Type}}]{priority, }
\item[{{\bf \-B\-W\-A\-P\-I\-::\-Upgrade\-Type}}]{type, }
\item[{int}]{level}
\end{DoxyParamCaption}
)}}\label{classUpgradeTask_ab771e8649897b761d4a427765c24e745}


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


\begin{DoxyCode}
        : Task(priority)
        , mType(type)
        , mLevel(level)
        , mReservedResources(false)
        , mRequiredSatisfyTime(BWAPI::Broodwar->getFrameCount())
{
}
\end{DoxyCode}


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classUpgradeTask_aeb01a65ed8c28b42e7136638cb0432af}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!dispatch\-Time@{dispatch\-Time}}
\index{dispatch\-Time@{dispatch\-Time}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{dispatch\-Time}]{\setlength{\rightskip}{0pt plus 5cm}virtual int {\bf \-Upgrade\-Task\-::dispatch\-Time} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classUpgradeTask_aeb01a65ed8c28b42e7136638cb0432af}


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



\-Definition at line 36 of file \-Upgrade\-Task.\-h.



\-References m\-Required\-Satisfy\-Time.


\begin{DoxyCode}
{ return mRequiredSatisfyTime; }
\end{DoxyCode}
\hypertarget{classUpgradeTask_a3797ee5a8500bf7bd0b98b6a2e79bc37}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!get\-End\-Location@{get\-End\-Location}}
\index{get\-End\-Location@{get\-End\-Location}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{get\-End\-Location}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Position} {\bf \-Upgrade\-Task\-::get\-End\-Location} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classUpgradeTask_a3797ee5a8500bf7bd0b98b6a2e79bc37}


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



\-Definition at line 35 of file \-Upgrade\-Task.\-cpp.


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


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



\-Definition at line 14 of file \-Upgrade\-Task.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Game\-::get\-Frame\-Count(), \-Requirement\-::max\-Time, m\-Level, m\-Required\-Satisfy\-Time, m\-Type, m\-Unit, and \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::upgrade\-Time().



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


\begin{DoxyCode}
{
        if(mUnit)
                return BWAPI::Broodwar->getFrameCount() + mUnit->
      getRemainingUpgradeTime();

        if(mRequiredSatisfyTime == Requirement::maxTime)
                return mRequiredSatisfyTime;

        return mRequiredSatisfyTime + mType.upgradeTime(mLevel);
}
\end{DoxyCode}


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




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


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


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



\-Definition at line 25 of file \-Upgrade\-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]{classUpgradeTask_abcdb860b0c72c9655c320f4ac92f9f1a_cgraph}
\end{center}
\end{figure}


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


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



\-Definition at line 114 of file \-Upgrade\-Task.\-cpp.



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


\begin{DoxyCode}
{
        UnitGroup returnUnits;

        if(mUnit)
                returnUnits.insert(mUnit);

        return returnUnits;
}
\end{DoxyCode}


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


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


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



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



\-References \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::get\-Name(), and m\-Type.


\begin{DoxyCode}
{ return mType.getName(); }
\end{DoxyCode}


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


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


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



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


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


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



\-Definition at line 30 of file \-Upgrade\-Task.\-cpp.


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


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



\-Definition at line 31 of file \-Upgrade\-Task.\-h.


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


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



\-Definition at line 80 of file \-Upgrade\-Task.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::gas\-Price(), \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::mineral\-Price(), m\-Level, m\-Required\-Satisfy\-Time, m\-Reserved\-Resources, m\-Type, m\-Unit, and \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::what\-Upgrades().


\begin{DoxyCode}
{
        if(unit->getType() == mType.whatUpgrades())
        {
                mUnit = unit;
                assert(mReservedResources == false);
                ResourceTracker::Instance().reserveCurrentMinerals(
      mRequiredSatisfyTime, mType.mineralPrice(mLevel));
                ResourceTracker::Instance().reserveCurrentGas(
      mRequiredSatisfyTime, mType.gasPrice(mLevel));
                mReservedResources = true;
        }
}
\end{DoxyCode}


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


\hypertarget{classUpgradeTask_a21fd78fcfd77ce2c7bb9394719407da6}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!has\-Dispatched@{has\-Dispatched}}
\index{has\-Dispatched@{has\-Dispatched}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{has\-Dispatched}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool {\bf \-Upgrade\-Task\-::has\-Dispatched} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classUpgradeTask_a21fd78fcfd77ce2c7bb9394719407da6}


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



\-Definition at line 39 of file \-Upgrade\-Task.\-h.



\-References m\-Unit.


\begin{DoxyCode}
{ return mUnit; }
\end{DoxyCode}
\hypertarget{classUpgradeTask_a38018a3c8a1935546c2760ef39840e2e}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!in\-Progress@{in\-Progress}}
\index{in\-Progress@{in\-Progress}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{in\-Progress}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool {\bf \-Upgrade\-Task\-::in\-Progress} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classUpgradeTask_a38018a3c8a1935546c2760ef39840e2e}


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



\-Definition at line 40 of file \-Upgrade\-Task.\-h.



\-References m\-Unit.


\begin{DoxyCode}
{ return mUnit && mUnit->isUpgrading(); }
\end{DoxyCode}
\hypertarget{classUpgradeTask_a191abe971493d30fe6a618c90eae4f12}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!morph@{morph}}
\index{morph@{morph}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{morph}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Upgrade\-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{classUpgradeTask_a191abe971493d30fe6a618c90eae4f12}


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



\-Definition at line 109 of file \-Upgrade\-Task.\-cpp.


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


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



\-Definition at line 40 of file \-Upgrade\-Task.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-Task\-::complete(), \-Task\-::is\-Canceled(), \-Task\-::is\-Completed(), \-Task\-::is\-Stopped(), m\-Level, m\-Type, m\-Unit, and update\-Requirements().


\begin{DoxyCode}
{
        if(BWAPI::Broodwar->self()->getUpgradeLevel(mType) >= mLevel)
                complete();

        if((isStopped() || isCanceled() || isCompleted()) && mUnit && !mUnit->
      isUpgrading())
                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]{classUpgradeTask_a59ae7874528489ca11e39beeb9833ba5_cgraph}
\end{center}
\end{figure}


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


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



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



\-References \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::gas\-Price(), \-Singleton$<$ T $>$\-::\-Instance(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::mineral\-Price(), m\-Level, m\-Required\-Satisfy\-Time, m\-Reserved\-Resources, m\-Type, m\-Unit, and \-Static\-Units\-::nullunit.


\begin{DoxyCode}
{
        if(mUnit == unit)
        {
                mUnit = StaticUnits::nullunit;

                if(mReservedResources)
                {
                        ResourceTracker::Instance().releaseCurrentMinerals(
      mRequiredSatisfyTime, mType.mineralPrice(mLevel));
                        ResourceTracker::Instance().releaseCurrentGas(
      mRequiredSatisfyTime, mType.gasPrice(mLevel));
                        mReservedResources = false;
                }
        }
        else
                assert(false);
}
\end{DoxyCode}


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


\hypertarget{classUpgradeTask_a8e8e8f04434cbf848a9c93d02672f5c5}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!set\-Required\-Satisfy\-Time@{set\-Required\-Satisfy\-Time}}
\index{set\-Required\-Satisfy\-Time@{set\-Required\-Satisfy\-Time}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{set\-Required\-Satisfy\-Time}]{\setlength{\rightskip}{0pt plus 5cm}virtual void {\bf \-Upgrade\-Task\-::set\-Required\-Satisfy\-Time} (
\begin{DoxyParamCaption}
\item[{{\bf \-Requirement\-Group}}]{requirements, }
\item[{int}]{time, }
\item[{int}]{delay}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classUpgradeTask_a8e8e8f04434cbf848a9c93d02672f5c5}


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



\-Definition at line 34 of file \-Upgrade\-Task.\-h.



\-References m\-Required\-Satisfy\-Time.


\begin{DoxyCode}
{ mRequiredSatisfyTime = time; }
\end{DoxyCode}
\hypertarget{classUpgradeTask_a395310788f4966ee851c5e02ae0ec1c4}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!start\-Time@{start\-Time}}
\index{start\-Time@{start\-Time}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{start\-Time}]{\setlength{\rightskip}{0pt plus 5cm}virtual int {\bf \-Upgrade\-Task\-::start\-Time} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}\label{classUpgradeTask_a395310788f4966ee851c5e02ae0ec1c4}


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



\-Definition at line 37 of file \-Upgrade\-Task.\-h.



\-References m\-Required\-Satisfy\-Time.


\begin{DoxyCode}
{ return mRequiredSatisfyTime; }
\end{DoxyCode}
\hypertarget{classUpgradeTask_a1a2d396b384dec70c65822e40026ae84}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!update@{update}}
\index{update@{update}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Upgrade\-Task\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}\label{classUpgradeTask_a1a2d396b384dec70c65822e40026ae84}


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



\-Definition at line 53 of file \-Upgrade\-Task.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::gas\-Price(), \-Task\-::has\-Ended(), \-Singleton$<$ T $>$\-::\-Instance(), \-Task\-::is\-Canceled(), \-Task\-::is\-Paused(), \-Task\-::is\-Stopped(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::mineral\-Price(), m\-Level, m\-Required\-Satisfy\-Time, m\-Reserved\-Resources, m\-Type, m\-Unit, and \-Task\-::should\-Return\-Unit().


\begin{DoxyCode}
{
        if(mUnit)
        {
                if(mUnit->isUpgrading())
                {
                        if(mUnit->getUpgrade() != mType || isStopped() || 
      isPaused() || isCanceled())
                                mUnit->cancel();
                        else if(mReservedResources)
                        {
                                ResourceTracker::Instance().
      releaseCurrentMinerals(mRequiredSatisfyTime, mType.mineralPrice(mLevel));
                                ResourceTracker::Instance().releaseCurrentGas(
      mRequiredSatisfyTime, mType.gasPrice(mLevel));
                                mReservedResources = false;
                        }
                }
                else if(!shouldReturnUnit())
                        mUnit->upgrade(mType);
        }

        return hasEnded() && !mUnit;
}
\end{DoxyCode}


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


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


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



\-Definition at line 129 of file \-Upgrade\-Task.\-cpp.



\-References \-Requirement\-Group\-::add\-Gas\-Requirement(), \-Requirement\-Group\-::add\-Mineral\-Requirement(), \-Task\-::add\-Requirement(), \-Requirement\-Group\-::add\-Tech\-For\-Type\-Requirement(), \-Requirement\-Group\-::add\-Unit\-Filter\-Requirement(), \-Task\-::clear\-Requirements(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::gas\-Price(), \-Unit\-Filter\-Flags\-::\-Is\-Complete, \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::mineral\-Price(), m\-Level, m\-Reserved\-Resources, m\-Type, m\-Unit, \-Task\-::should\-Return\-Unit(), \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::upgrade\-Time(), and \-B\-W\-A\-P\-I\-::\-Upgrade\-Type\-::what\-Upgrades().



\-Referenced by pre\-Update().


\begin{DoxyCode}
{
        clearRequirements();

        if(!mUnit && !shouldReturnUnit())
        {
                RequirementGroup requiredConditions;

                assert(mReservedResources == false);
                requiredConditions.addTechForTypeRequirement(mType, mLevel);
                requiredConditions.addUnitFilterRequirement(40, mType.
      upgradeTime(mLevel), UnitFilter(mType.whatUpgrades()) && UnitFilter(
      UnitFilterFlags::IsComplete));
                requiredConditions.addMineralRequirement(mType.mineralPrice(
      mLevel));
                requiredConditions.addGasRequirement(mType.gasPrice(mLevel));

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


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




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


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


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



\-Definition at line 75 of file \-Upgrade\-Task.\-cpp.


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


\subsection{\-Member \-Data \-Documentation}
\hypertarget{classUpgradeTask_aba3f1566e59bf76acad0f3d3f9179cb6}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!m\-Level@{m\-Level}}
\index{m\-Level@{m\-Level}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{m\-Level}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Upgrade\-Task\-::m\-Level}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classUpgradeTask_aba3f1566e59bf76acad0f3d3f9179cb6}


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



\-Referenced by get\-End\-Time(), give\-Unit(), pre\-Update(), return\-Unit(), update(), and update\-Requirements().

\hypertarget{classUpgradeTask_ac960540c184f999b5c02b5d00137c403}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!m\-Required\-Satisfy\-Time@{m\-Required\-Satisfy\-Time}}
\index{m\-Required\-Satisfy\-Time@{m\-Required\-Satisfy\-Time}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{m\-Required\-Satisfy\-Time}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf \-Upgrade\-Task\-::m\-Required\-Satisfy\-Time}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classUpgradeTask_ac960540c184f999b5c02b5d00137c403}


\-Definition at line 48 of file \-Upgrade\-Task.\-h.



\-Referenced by dispatch\-Time(), get\-End\-Time(), give\-Unit(), return\-Unit(), set\-Required\-Satisfy\-Time(), start\-Time(), and update().

\hypertarget{classUpgradeTask_a9b909173e08c72ed7fda2ee14842b6a1}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!m\-Reserved\-Resources@{m\-Reserved\-Resources}}
\index{m\-Reserved\-Resources@{m\-Reserved\-Resources}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{m\-Reserved\-Resources}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Upgrade\-Task\-::m\-Reserved\-Resources}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classUpgradeTask_a9b909173e08c72ed7fda2ee14842b6a1}


\-Definition at line 50 of file \-Upgrade\-Task.\-h.



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

\hypertarget{classUpgradeTask_ae2a81e857c940388f984970fb95df931}{\index{\-Upgrade\-Task@{\-Upgrade\-Task}!m\-Type@{m\-Type}}
\index{m\-Type@{m\-Type}!UpgradeTask@{\-Upgrade\-Task}}
\subsubsection[{m\-Type}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-B\-W\-A\-P\-I\-::\-Upgrade\-Type} {\bf \-Upgrade\-Task\-::m\-Type}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classUpgradeTask_ae2a81e857c940388f984970fb95df931}


\-Definition at line 43 of file \-Upgrade\-Task.\-h.



\-Referenced by get\-End\-Time(), get\-Output\-Name(), give\-Unit(), pre\-Update(), return\-Unit(), update(), and update\-Requirements().

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


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



\-Referenced by get\-End\-Time(), get\-Finished\-Units(), give\-Unit(), has\-Dispatched(), in\-Progress(), pre\-Update(), return\-Unit(), update(), and update\-Requirements().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{UpgradeTask_8h}{\-Upgrade\-Task.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{UpgradeTask_8cpp}{\-Upgrade\-Task.\-cpp}\end{DoxyCompactItemize}
