Fix #427, AMTL Code porting (#436)

* Fix crash in CTaskMngr::startFrame()

* Fix crash in EventsMngr::executeEvents()

* Fix loops

* Fix loop iterators signess
This commit is contained in:
In-line 2017-05-11 11:35:38 +04:00 committed by Vincent Herbet
parent 7794f27dc2
commit df4e4949c8
2 changed files with 8 additions and 2 deletions

View File

@ -458,8 +458,11 @@ void EventsMngr::executeEvents()
auto parseFun = m_ParseFun;
m_ParseFun = nullptr;
for (auto &event : *parseFun)
auto lastSize = parseFun->length();
for(auto i = 0u; i < lastSize; i++)
{
auto &event = parseFun->at(i);
if (event->m_Done)
{
event->m_Done = false;

View File

@ -269,8 +269,11 @@ bool CTaskMngr::taskExists(int iId, AMX *pAmx)
void CTaskMngr::startFrame()
{
for (auto &task : m_Tasks)
auto lastSize = m_Tasks.length();
for(auto i = 0u; i < lastSize; i++)
{
auto &task = m_Tasks[i];
if (task->isFree())
continue;
task->executeIfRequired(*m_pTmr_CurrentTime, *m_pTmr_TimeLimit, *m_pTmr_TimeLeft);