From 7ce143bd9e130fd0507338e58ade153f83a668a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 24 Jan 2023 20:11:33 +0100 Subject: [PATCH] Add `CEnvPoint::MAX_CHANNELS` constant --- src/game/editor/editor.cpp | 6 +++--- src/game/mapitems.h | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 6d5f75bce..e907353fe 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -4955,21 +4955,21 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) ToolBar.VSplitLeft(15.0f, &Button, &ToolBar); - static const char *s_aapNames[4][4] = { + static const char *s_aapNames[4][CEnvPoint::MAX_CHANNELS] = { {"V", "", "", ""}, {"", "", "", ""}, {"X", "Y", "R", ""}, {"R", "G", "B", "A"}, }; - static const char *s_aapDescriptions[4][4] = { + static const char *s_aapDescriptions[4][CEnvPoint::MAX_CHANNELS] = { {"Volume of the envelope", "", "", ""}, {"", "", "", ""}, {"X-axis of the envelope", "Y-axis of the envelope", "Rotation of the envelope", ""}, {"Red value of the envelope", "Green value of the envelope", "Blue value of the envelope", "Alpha value of the envelope"}, }; - static int s_aChannelButtons[4] = {0}; + static int s_aChannelButtons[CEnvPoint::MAX_CHANNELS] = {0}; int Bit = 1; for(int i = 0; i < pEnvelope->m_Channels; i++, Bit <<= 1) diff --git a/src/game/mapitems.h b/src/game/mapitems.h index f462b122e..a3cbf6ee0 100644 --- a/src/game/mapitems.h +++ b/src/game/mapitems.h @@ -342,9 +342,14 @@ struct CMapItemVersion struct CEnvPoint { + enum + { + MAX_CHANNELS = 4, + }; + int m_Time; // in ms int m_Curvetype; - int m_aValues[4]; // 1-4 depending on envelope (22.10 fixed point) + int m_aValues[MAX_CHANNELS]; // 1-4 depending on envelope (22.10 fixed point) bool operator<(const CEnvPoint &Other) const { return m_Time < Other.m_Time; } };