Skip to content

Commit 2ca8008

Browse files
authored
Mark some animstate pointers const that refer to client data (ddnet#11677)
2 parents 1a8e808 + c9f0184 commit 2ca8008

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/game/client/animstate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ static void AnimSeqEval(const CAnimSequence *pSeq, float Time, CAnimKeyframe *pF
2222
}
2323
else
2424
{
25-
CAnimKeyframe *pFrame1 = nullptr;
26-
CAnimKeyframe *pFrame2 = nullptr;
25+
const CAnimKeyframe *pFrame1 = nullptr;
26+
const CAnimKeyframe *pFrame2 = nullptr;
2727
float Blend = 0.0f;
2828

2929
// TODO: make this smarter.. binary search
@@ -65,15 +65,15 @@ void CAnimState::AnimAdd(CAnimState *pState, const CAnimState *pAdded, float Amo
6565
AnimAddKeyframe(&pState->m_Attach, pAdded->GetAttach(), Amount);
6666
}
6767

68-
void CAnimState::Set(CAnimation *pAnim, float Time)
68+
void CAnimState::Set(const CAnimation *pAnim, float Time)
6969
{
7070
AnimSeqEval(&pAnim->m_Body, Time, &m_Body);
7171
AnimSeqEval(&pAnim->m_BackFoot, Time, &m_BackFoot);
7272
AnimSeqEval(&pAnim->m_FrontFoot, Time, &m_FrontFoot);
7373
AnimSeqEval(&pAnim->m_Attach, Time, &m_Attach);
7474
}
7575

76-
void CAnimState::Add(CAnimation *pAnim, float Time, float Amount)
76+
void CAnimState::Add(const CAnimation *pAnim, float Time, float Amount)
7777
{
7878
CAnimState Add;
7979
Add.Set(pAnim, Time);

src/game/client/animstate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class CAnimState
1919
const CAnimKeyframe *GetBackFoot() const { return &m_BackFoot; }
2020
const CAnimKeyframe *GetFrontFoot() const { return &m_FrontFoot; }
2121
const CAnimKeyframe *GetAttach() const { return &m_Attach; }
22-
void Set(CAnimation *pAnim, float Time);
23-
void Add(CAnimation *pAnim, float Time, float Amount);
22+
void Set(const CAnimation *pAnim, float Time);
23+
void Add(const CAnimation *pAnim, float Time, float Amount);
2424

2525
const static CAnimState *GetIdle();
2626
};

0 commit comments

Comments
 (0)