From 4ac9bce906fdb1b47f0114825fc07951414a47fd Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 13 Feb 2019 19:07:59 -0300 Subject: [PATCH] Update Screen.cpp --- src/Screen.cpp | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index ba8c1a70b4..6bfac9b794 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -111,49 +111,6 @@ Screen::EndScreen() m_bRunning = false; } -inline void -Screen::UpdateTimedFunctions(float fDeltaTime) -{ - for (auto it = delayedFunctions.begin(); it != delayedFunctions.end(); - ++it) { - auto& delayedF = *it; - delayedF.second -= fDeltaTime; - if (delayedF.second <= 0) { - delayedF.first(); - } - } - // Doing this in place did weird things - delayedFunctions.erase(std::remove_if(delayedFunctions.begin(), - delayedFunctions.end(), - [](pair, float>& x) { - return x.second <= 0; - }), - delayedFunctions.end()); - if (!delayedPeriodicFunctionIdsToDelete.empty()) { - auto* L = LUA->Get(); - for (auto id : delayedPeriodicFunctionIdsToDelete) { - luaL_unref(L, LUA_REGISTRYINDEX, id); - auto& vec = this->delayedPeriodicFunctions; - vec.erase(std::remove_if( - vec.begin(), - vec.end(), - [id](tuple, float, float, int>& x) { - return std::get<3>(x) == id; - }), - vec.end()); - } - LUA->Release(L); - delayedPeriodicFunctionIdsToDelete.clear(); - } - for (auto& delayedF : delayedPeriodicFunctions) { - std::get<1>(delayedF) -= fDeltaTime; - if (std::get<1>(delayedF) <= 0) { - std::get<0>(delayedF)(); - std::get<1>(delayedF) = std::get<2>(delayedF); - } - } -} - void Screen::UpdateTimedFunctions(float fDeltaTime) {