\hypertarget{classLatencyTrackerClass}{\section{\-Latency\-Tracker\-Class \-Class \-Reference}
\label{classLatencyTrackerClass}\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}}
}


{\ttfamily \#include $<$\-Latency\-Tracker.\-h$>$}

\subsection*{\-Public \-Member \-Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classLatencyTrackerClass_a3203700ca498e0f624146d8adcf5c257}{\-Latency\-Tracker\-Class} ()
\item 
void \hyperlink{classLatencyTrackerClass_ac9a5f36685c470fd0087c159ad11b407}{update} ()
\item 
void \hyperlink{classLatencyTrackerClass_aeb0eb895ebb09787334cd155f53485e3}{placing\-Storm} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit, \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} pos)
\item 
void \hyperlink{classLatencyTrackerClass_a5b25c65cf554557b3c89839c3ee79a71}{placing\-Stasis} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit, \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position} pos)
\item 
bool \hyperlink{classLatencyTrackerClass_a85218ab39af0204ca6e3f1a2cb63f75e}{is\-Storm\-In\-Range} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\item 
bool \hyperlink{classLatencyTrackerClass_aa916135be6cb5559354d374e63e1dbeb}{is\-Stasis\-In\-Range} (\hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit} unit)
\end{DoxyCompactItemize}
\subsection*{\-Private \-Attributes}
\begin{DoxyCompactItemize}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit}, std\-::pair\*
$<$ \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position}, int $>$ $>$ \hyperlink{classLatencyTrackerClass_aa3641d11dce07364bb404b1ea8dd7e30}{m\-Stormed\-Positions}
\item 
std\-::map$<$ \hyperlink{Interface_8h_ab8fbb9e601c27f783b69f16c5a1fd40a}{\-Unit}, std\-::pair\*
$<$ \hyperlink{Interface_8h_a7ae5d695cf6b7c013c5ad30d124278e0}{\-Position}, int $>$ $>$ \hyperlink{classLatencyTrackerClass_a61b44da3579b004b221987e7c7cc7632}{m\-Stasis\-Positions}
\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}


\-Definition at line 8 of file \-Latency\-Tracker.\-h.



\subsection{\-Constructor \& \-Destructor \-Documentation}
\hypertarget{classLatencyTrackerClass_a3203700ca498e0f624146d8adcf5c257}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}}
\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{\-Latency\-Tracker\-Class}]{\setlength{\rightskip}{0pt plus 5cm}{\bf \-Latency\-Tracker\-Class\-::\-Latency\-Tracker\-Class} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}\label{classLatencyTrackerClass_a3203700ca498e0f624146d8adcf5c257}


\-Definition at line 11 of file \-Latency\-Tracker.\-h.


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


\subsection{\-Member \-Function \-Documentation}
\hypertarget{classLatencyTrackerClass_aa916135be6cb5559354d374e63e1dbeb}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!is\-Stasis\-In\-Range@{is\-Stasis\-In\-Range}}
\index{is\-Stasis\-In\-Range@{is\-Stasis\-In\-Range}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{is\-Stasis\-In\-Range}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Latency\-Tracker\-Class\-::is\-Stasis\-In\-Range} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
)}}\label{classLatencyTrackerClass_aa916135be6cb5559354d374e63e1dbeb}


\-Definition at line 50 of file \-Latency\-Tracker.\-cpp.



\-References m\-Stasis\-Positions, and \-Stasis\-Radius.


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

        for(std::map<Unit, std::pair<Position, int>>::iterator it = 
      mStasisPositions.begin(); it != mStasisPositions.end(); ++it)
        {
                if(it->second.first.getApproxDistance(unit->getPosition()) <= 
      StasisRadius)
                        return true;
        }

        return false;
}\end{DoxyCode}
\hypertarget{classLatencyTrackerClass_a85218ab39af0204ca6e3f1a2cb63f75e}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!is\-Storm\-In\-Range@{is\-Storm\-In\-Range}}
\index{is\-Storm\-In\-Range@{is\-Storm\-In\-Range}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{is\-Storm\-In\-Range}]{\setlength{\rightskip}{0pt plus 5cm}bool {\bf \-Latency\-Tracker\-Class\-::is\-Storm\-In\-Range} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit}
\end{DoxyParamCaption}
)}}\label{classLatencyTrackerClass_a85218ab39af0204ca6e3f1a2cb63f75e}


\-Definition at line 36 of file \-Latency\-Tracker.\-cpp.



\-References m\-Stormed\-Positions, and \-Storm\-Radius.


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

        for(std::map<Unit, std::pair<Position, int>>::iterator it = 
      mStormedPositions.begin(); it != mStormedPositions.end(); ++it)
        {
                if(it->second.first.getApproxDistance(unit->getPosition()) <= 
      StormRadius)
                        return true;
        }

        return false;
}
\end{DoxyCode}
\hypertarget{classLatencyTrackerClass_a5b25c65cf554557b3c89839c3ee79a71}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!placing\-Stasis@{placing\-Stasis}}
\index{placing\-Stasis@{placing\-Stasis}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{placing\-Stasis}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Latency\-Tracker\-Class\-::placing\-Stasis} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit, }
\item[{{\bf \-Position}}]{pos}
\end{DoxyParamCaption}
)}}\label{classLatencyTrackerClass_a5b25c65cf554557b3c89839c3ee79a71}


\-Definition at line 31 of file \-Latency\-Tracker.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, and m\-Stasis\-Positions.


\begin{DoxyCode}
{
        mStasisPositions[unit] = std::make_pair(pos, BWAPI::Broodwar->
      getFrameCount() + BWAPI::Broodwar->getRemainingLatencyFrames());
}
\end{DoxyCode}
\hypertarget{classLatencyTrackerClass_aeb0eb895ebb09787334cd155f53485e3}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!placing\-Storm@{placing\-Storm}}
\index{placing\-Storm@{placing\-Storm}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{placing\-Storm}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Latency\-Tracker\-Class\-::placing\-Storm} (
\begin{DoxyParamCaption}
\item[{{\bf \-Unit}}]{unit, }
\item[{{\bf \-Position}}]{pos}
\end{DoxyParamCaption}
)}}\label{classLatencyTrackerClass_aeb0eb895ebb09787334cd155f53485e3}


\-Definition at line 26 of file \-Latency\-Tracker.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, and m\-Stormed\-Positions.


\begin{DoxyCode}
{
        mStormedPositions[unit] = std::make_pair(pos, BWAPI::Broodwar->
      getFrameCount() + BWAPI::Broodwar->getRemainingLatencyFrames());
}
\end{DoxyCode}
\hypertarget{classLatencyTrackerClass_ac9a5f36685c470fd0087c159ad11b407}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!update@{update}}
\index{update@{update}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf \-Latency\-Tracker\-Class\-::update} (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classLatencyTrackerClass_ac9a5f36685c470fd0087c159ad11b407}


\-Definition at line 6 of file \-Latency\-Tracker.\-cpp.



\-References \-B\-W\-A\-P\-I\-::\-Broodwar, \-B\-W\-A\-P\-I\-::\-Orders\-::\-Cast\-Psionic\-Storm, \-B\-W\-A\-P\-I\-::\-Orders\-::\-Cast\-Stasis\-Field, \-B\-W\-A\-P\-I\-::\-Game\-::get\-Frame\-Count(), m\-Stasis\-Positions, and m\-Stormed\-Positions.


\begin{DoxyCode}
{
        const int time = BWAPI::Broodwar->getFrameCount();
        for(std::map<Unit, std::pair<Position, int>>::iterator it = 
      mStormedPositions.begin(); it != mStormedPositions.end();)
        {
                if(!it->first->exists() || (it->first->getOrder() != 
      BWAPI::Orders::CastPsionicStorm && time > it->second.second))
                        mStormedPositions.erase(it++);
                else
                        ++it;
        }

        for(std::map<Unit, std::pair<Position, int>>::iterator it = 
      mStasisPositions.begin(); it != mStasisPositions.end();)
        {
                if(!it->first->exists() || (it->first->getOrder() != 
      BWAPI::Orders::CastStasisField && time > it->second.second))
                        mStasisPositions.erase(it++);
                else
                        ++it;
        }
}
\end{DoxyCode}


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




\subsection{\-Member \-Data \-Documentation}
\hypertarget{classLatencyTrackerClass_a61b44da3579b004b221987e7c7cc7632}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!m\-Stasis\-Positions@{m\-Stasis\-Positions}}
\index{m\-Stasis\-Positions@{m\-Stasis\-Positions}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{m\-Stasis\-Positions}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Unit}, std\-::pair$<${\bf \-Position}, int$>$ $>$ {\bf \-Latency\-Tracker\-Class\-::m\-Stasis\-Positions}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classLatencyTrackerClass_a61b44da3579b004b221987e7c7cc7632}


\-Definition at line 23 of file \-Latency\-Tracker.\-h.



\-Referenced by is\-Stasis\-In\-Range(), placing\-Stasis(), and update().

\hypertarget{classLatencyTrackerClass_aa3641d11dce07364bb404b1ea8dd7e30}{\index{\-Latency\-Tracker\-Class@{\-Latency\-Tracker\-Class}!m\-Stormed\-Positions@{m\-Stormed\-Positions}}
\index{m\-Stormed\-Positions@{m\-Stormed\-Positions}!LatencyTrackerClass@{\-Latency\-Tracker\-Class}}
\subsubsection[{m\-Stormed\-Positions}]{\setlength{\rightskip}{0pt plus 5cm}std\-::map$<${\bf \-Unit}, std\-::pair$<${\bf \-Position}, int$>$ $>$ {\bf \-Latency\-Tracker\-Class\-::m\-Stormed\-Positions}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}\label{classLatencyTrackerClass_aa3641d11dce07364bb404b1ea8dd7e30}


\-Definition at line 22 of file \-Latency\-Tracker.\-h.



\-Referenced by is\-Storm\-In\-Range(), placing\-Storm(), and update().



\-The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
\-Skynet/\-Skynet/\hyperlink{LatencyTracker_8h}{\-Latency\-Tracker.\-h}\item 
\-Skynet/\-Skynet/\hyperlink{LatencyTracker_8cpp}{\-Latency\-Tracker.\-cpp}\end{DoxyCompactItemize}
