Fix first value in graphs being incorrect

As the index was incremented before setting the value, the value at index 0 was not set correctly until the ringbuffer wraps around.
This commit is contained in:
Robert Müller 2023-10-17 18:08:33 +02:00
parent dc7fa1fbb2
commit fb96217147

View file

@ -38,8 +38,8 @@ void CGraph::Scale()
void CGraph::Add(float Value, ColorRGBA Color)
{
m_Index = (m_Index + 1) % MAX_VALUES;
InsertAt(m_Index, Value, Color);
m_Index = (m_Index + 1) % MAX_VALUES;
}
void CGraph::InsertAt(size_t Index, float Value, ColorRGBA Color)