18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-28 05:47:54 +01:00

refactor: no fields shadowing the base class's (Sonar S2387) (#366)

TSt113 declared its own CP, which hid TH14K1::CP. TSt113 overrides
every TH14K1 method that touches CP (GetPF sets it from PP before
reading it, GetCP, Init), so the base field was never used in it; the
derived one is deleted and the St113 uses the inherited field. A new
test records the control chamber, brake pipe, cylinder and EP of the
EN57's St113 over an application and a release; it was written and
passed on the code before the change and passes unchanged after it.

perfgraph_panel::pos, the write index of the timings' ring buffer,
hid ui_panel::pos, the window position; it becomes history_pos.
This commit is contained in:
jerrrrycho
2026-11-20 03:43:01 +01:00
committed by GitHub
parent c2b034ddcd
commit 4a52b5affc
4 changed files with 85 additions and 9 deletions

View File

@@ -49,13 +49,13 @@ void perfgraph_panel::render_contents() {
if (!stopwatch)
return;
history[pos] = static_cast<float>(static_cast<double>(stopwatch->last().count()) / 1000.0);
const std::string label = std::to_string(history[pos]) + "ms";
history[history_pos] = static_cast<float>(static_cast<double>(stopwatch->last().count()) / 1000.0);
const std::string label = std::to_string(history[history_pos]) + "ms";
pos++;
if (pos >= history.size())
pos = 0;
history_pos++;
if (history_pos >= history.size())
history_pos = 0;
ImGui::SliderFloat(STR_C("Range"), &max, 0.1f, 250.0f);
ImGui::PlotLines("##timer", &history[0], static_cast<int>(history.size()), static_cast<int>(pos), label.c_str(), 0.0f, max, ImVec2(500, 200));
ImGui::PlotLines("##timer", &history[0], static_cast<int>(history.size()), static_cast<int>(history_pos), label.c_str(), 0.0f, max, ImVec2(500, 200));
}