From b6ff2c87982d01cba14a52fad46a1b6b5cd981d7 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 9 Sep 2022 02:28:03 +0200 Subject: [PATCH] Light cleanup --- r5dev/public/iframetask.h | 4 ++-- r5dev/tier0/frametask.cpp | 8 ++++---- r5dev/tier0/frametask.h | 2 +- r5dev/vpklib/packedstore.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/r5dev/public/iframetask.h b/r5dev/public/iframetask.h index dc747405..cd901a1d 100644 --- a/r5dev/public/iframetask.h +++ b/r5dev/public/iframetask.h @@ -1,11 +1,11 @@ #ifndef TIER0_IFRAMETASK_H #define TIER0_IFRAMETASK_H -struct DelayedCall_s +struct ScheduledTasks_s { int m_nDelayedFrames; std::function m_rFunctor; - DelayedCall_s(int frames, std::function functor) + ScheduledTasks_s(int frames, std::function functor) { m_nDelayedFrames = frames; m_rFunctor = functor; diff --git a/r5dev/tier0/frametask.cpp b/r5dev/tier0/frametask.cpp index e0f2deaa..337c5a1d 100644 --- a/r5dev/tier0/frametask.cpp +++ b/r5dev/tier0/frametask.cpp @@ -14,7 +14,7 @@ void CFrameTask::RunFrame() { std::lock_guard l(m_Mutex); - for (auto& delay : m_DelayedCalls) + for (auto& delay : m_ScheduledTasks) { delay.m_nDelayedFrames = (std::max)(delay.m_nDelayedFrames - 1, 0); if (delay.m_nDelayedFrames == 0) @@ -23,11 +23,11 @@ void CFrameTask::RunFrame() } } - auto newEnd = std::remove_if(m_DelayedCalls.begin(), m_DelayedCalls.end(), [](const DelayedCall_s& delay) + auto newEnd = std::remove_if(m_ScheduledTasks.begin(), m_ScheduledTasks.end(), [](const ScheduledTasks_s& delay) { return delay.m_nDelayedFrames == 0; }); - m_DelayedCalls.erase(newEnd, m_DelayedCalls.end()); + m_ScheduledTasks.erase(newEnd, m_ScheduledTasks.end()); } //----------------------------------------------------------------------------- @@ -47,7 +47,7 @@ bool CFrameTask::IsFinished() const void CFrameTask::Dispatch(std::function functor, int frames) { std::lock_guard l(m_Mutex); - m_DelayedCalls.emplace_back(frames, functor); + m_ScheduledTasks.emplace_back(frames, functor); } //----------------------------------------------------------------------------- diff --git a/r5dev/tier0/frametask.h b/r5dev/tier0/frametask.h index 44420e61..e5189f6e 100644 --- a/r5dev/tier0/frametask.h +++ b/r5dev/tier0/frametask.h @@ -21,7 +21,7 @@ public: private: mutable std::mutex m_Mutex; - std::list m_DelayedCalls; + std::list m_ScheduledTasks; }; extern std::list g_FrameTasks; diff --git a/r5dev/vpklib/packedstore.cpp b/r5dev/vpklib/packedstore.cpp index d561e1fc..91ca2f24 100644 --- a/r5dev/vpklib/packedstore.cpp +++ b/r5dev/vpklib/packedstore.cpp @@ -657,7 +657,7 @@ VPKEntryBlock_t::VPKEntryBlock_t(CIOStream* pReader, string svEntryPath) //----------------------------------------------------------------------------- VPKEntryBlock_t::VPKEntryBlock_t(const vector &vData, int64_t nOffset, uint16_t nPreloadSize, uint16_t nArchiveIndex, uint32_t nLoadFlags, uint16_t nTextureFlags, const string& svEntryPath) { - m_nFileCRC = crc32::update(m_nFileCRC, vData.data(), vData.size()); + m_nFileCRC = crc32::update(NULL, vData.data(), vData.size()); m_iPreloadSize = nPreloadSize; m_iPackFileIndex = nArchiveIndex; m_svEntryPath = svEntryPath;