Use CGraph::MAX_VALUES instead of magic value in debughud

This commit is contained in:
Robert Müller 2022-08-12 14:01:46 +02:00
parent 8e0a935d5c
commit b314db5454

View file

@ -144,8 +144,7 @@ void CDebugHud::RenderTuning()
m_RampGraph.Init(0.0f, 0.0f);
m_SpeedTurningPoint = 0;
float pv = 1;
// CGraph must be fed with exactly 128 values.
for(int i = 0; i < 128; i++)
for(size_t i = 0; i < CGraph::MAX_VALUES; i++)
{
// This is a calculation of the speed values per second on the X axis, from 270 to 34560 in steps of 270
float Speed = (i + 1) * StepSizeRampGraph;
@ -167,7 +166,7 @@ void CDebugHud::RenderTuning()
m_ZoomedInGraph.Init(0.0f, 0.0f);
pv = 1;
MiddleOfZoomedInGraph = m_SpeedTurningPoint;
for(int i = 0; i < 128; i++)
for(size_t i = 0; i < CGraph::MAX_VALUES; i++)
{
// This is a calculation of the speed values per second on the X axis, from (MiddleOfZoomedInGraph - 64 * StepSize) to (MiddleOfZoomedInGraph + 64 * StepSize)
float Speed = MiddleOfZoomedInGraph - 64 * StepSizeZoomedInGraph + i * StepSizeZoomedInGraph;