Fixed bug at17357 (FireStorm)
This commit is contained in:
parent
593e013572
commit
661f6c9851
|
@ -53,8 +53,14 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
|
||||||
m_iId = iId;
|
m_iId = iId;
|
||||||
m_fBase = fBase;
|
m_fBase = fBase;
|
||||||
|
|
||||||
m_iRepeat = (iFlags & 1) ? iRepeat : 0;
|
if (iFlags & 2)
|
||||||
m_bLoop = (iFlags & 2) ? true : false;
|
{
|
||||||
|
m_bLoop = true;
|
||||||
|
m_iRepeat = -1;
|
||||||
|
} else if (iFlags & 1) {
|
||||||
|
m_bLoop = true;
|
||||||
|
m_iRepeat = iRepeat;
|
||||||
|
}
|
||||||
m_bAfterStart = (iFlags & 4) ? true : false;
|
m_bAfterStart = (iFlags & 4) ? true : false;
|
||||||
m_bBeforeEnd = (iFlags & 8) ? true : false;
|
m_bBeforeEnd = (iFlags & 8) ? true : false;
|
||||||
|
|
||||||
|
@ -118,6 +124,7 @@ void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime)
|
||||||
void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft)
|
void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft)
|
||||||
{
|
{
|
||||||
bool execute=false;
|
bool execute=false;
|
||||||
|
bool done=false;
|
||||||
if (m_bAfterStart)
|
if (m_bAfterStart)
|
||||||
{
|
{
|
||||||
if (fCurrentTime - fTimeLeft + 1.0f >= m_fBase)
|
if (fCurrentTime - fTimeLeft + 1.0f >= m_fBase)
|
||||||
|
@ -127,11 +134,14 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
|
||||||
{
|
{
|
||||||
if (fTimeLimit != 0.0f && (fTimeLeft + fTimeLimit * 60.0f) - fCurrentTime - 1.0f <= m_fBase)
|
if (fTimeLimit != 0.0f && (fTimeLeft + fTimeLimit * 60.0f) - fCurrentTime - 1.0f <= m_fBase)
|
||||||
execute = true;
|
execute = true;
|
||||||
}
|
} else if (m_fNextExecTime <= fCurrentTime) {
|
||||||
else if (m_fNextExecTime <= fCurrentTime)
|
|
||||||
execute = true;
|
execute = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (execute)
|
if (execute)
|
||||||
|
{
|
||||||
|
//only bother calling if we have something to call
|
||||||
|
if ( !(m_bLoop && !m_iRepeat) )
|
||||||
{
|
{
|
||||||
if (m_iParamLen) // call with parameters
|
if (m_iParamLen) // call with parameters
|
||||||
{
|
{
|
||||||
|
@ -140,18 +150,25 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
|
||||||
} else {
|
} else {
|
||||||
executeForwards(m_iFunc, m_iId);
|
executeForwards(m_iFunc, m_iId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isFree())
|
if (isFree())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// set new exec time OR remove the task if needed
|
// set new exec time OR remove the task if needed
|
||||||
if (m_bLoop || (m_iRepeat-- > 0))
|
if (m_bLoop)
|
||||||
{
|
{
|
||||||
m_fNextExecTime += m_fBase;
|
if (m_iRepeat != -1 && --m_iRepeat <= 0)
|
||||||
|
done = true;
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (done)
|
||||||
{
|
{
|
||||||
clear(); // hamster
|
clear();
|
||||||
|
} else {
|
||||||
|
m_fNextExecTime += m_fBase;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user