From b9f82e9968efb2faad5ae50f806b033bbfa12549 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 16 Dec 2024 18:31:07 +0000 Subject: animationmgr: fixup stack-use-after-return --- src/managers/AnimationManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/managers/AnimationManager.cpp') diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index a61c20a1..c8f7ecdf 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -156,9 +156,9 @@ void CAnimationManager::tick() { // beziers are with a switch unforto // TODO: maybe do something cleaner - static const auto updateVariable = [&](CAnimatedVariable& av) { + static const auto updateVariable = [this](CAnimatedVariable& av, const float SPENT, const CBezierCurve& DEFAULTBEZIER, const bool DISABLED) { // for disabled anims just warp - if (av.m_pConfig->pValues->internalEnabled == 0 || animationsDisabled) { + if (av.m_pConfig->pValues->internalEnabled == 0 || DISABLED) { av.warp(false); return; } @@ -169,7 +169,7 @@ void CAnimationManager::tick() { } const auto BEZIER = m_mBezierCurves.find(av.m_pConfig->pValues->internalBezier); - const auto POINTY = BEZIER != m_mBezierCurves.end() ? BEZIER->second.getYForPoint(SPENT) : DEFAULTBEZIER->second.getYForPoint(SPENT); + const auto POINTY = BEZIER != m_mBezierCurves.end() ? BEZIER->second.getYForPoint(SPENT) : DEFAULTBEZIER.getYForPoint(SPENT); const auto DELTA = av.m_Goal - av.m_Begun; @@ -179,9 +179,9 @@ void CAnimationManager::tick() { av.m_Value = av.m_Begun + DELTA * POINTY; }; - static const auto updateColorVariable = [&](CAnimatedVariable& av) { + static const auto updateColorVariable = [this](CAnimatedVariable& av, const float SPENT, const CBezierCurve& DEFAULTBEZIER, const bool DISABLED) { // for disabled anims just warp - if (av.m_pConfig->pValues->internalEnabled == 0 || animationsDisabled) { + if (av.m_pConfig->pValues->internalEnabled == 0 || DISABLED) { av.warp(false); return; } @@ -192,7 +192,7 @@ void CAnimationManager::tick() { } const auto BEZIER = m_mBezierCurves.find(av.m_pConfig->pValues->internalBezier); - const auto POINTY = BEZIER != m_mBezierCurves.end() ? BEZIER->second.getYForPoint(SPENT) : DEFAULTBEZIER->second.getYForPoint(SPENT); + const auto POINTY = BEZIER != m_mBezierCurves.end() ? BEZIER->second.getYForPoint(SPENT) : DEFAULTBEZIER.getYForPoint(SPENT); // convert both to OkLab, then lerp that, and convert back. // This is not as fast as just lerping rgb, but it's WAY more precise... @@ -217,17 +217,17 @@ void CAnimationManager::tick() { switch (av->m_Type) { case AVARTYPE_FLOAT: { auto typedAv = dynamic_cast*>(av); - updateVariable(*typedAv); + updateVariable(*typedAv, SPENT, DEFAULTBEZIER->second, animationsDisabled); break; } case AVARTYPE_VECTOR: { auto typedAv = dynamic_cast*>(av); - updateVariable(*typedAv); + updateVariable(*typedAv, SPENT, DEFAULTBEZIER->second, animationsDisabled); break; } case AVARTYPE_COLOR: { auto typedAv = dynamic_cast*>(av); - updateColorVariable(*typedAv); + updateColorVariable(*typedAv, SPENT, DEFAULTBEZIER->second, animationsDisabled); break; } default: UNREACHABLE(); -- cgit v1.2.3