From bf395c8ac1423f320d9243a1b8b71aaae98e06ed Mon Sep 17 00:00:00 2001 From: Nextra Date: Mon, 1 Jul 2013 22:58:56 +0200 Subject: [PATCH] Fix definitevely time drift on repeating tasks (bug 3302, r=dvander) Former-commit-id: 28aa4dfbf7cb03a2d929423ef3c607f92a96aa75 --- amxmodx/CTask.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/amxmodx/CTask.cpp b/amxmodx/CTask.cpp index a17e82cb..d5e9b59c 100755 --- a/amxmodx/CTask.cpp +++ b/amxmodx/CTask.cpp @@ -112,8 +112,10 @@ void CTaskMngr::CTask::changeBase(float fNewBase) } void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime) -{ - m_fNextExecTime = fCurrentTime + m_fBase; +{ + // If we're here while we're executing we would add m_fBase twice + if (!m_bInExecute) + m_fNextExecTime = fCurrentTime + m_fBase; } void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft)