mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Simplify iteration of framerate performance elements.
parent
97bea563d7
commit
830c9e2de8
|
@ -817,8 +817,8 @@ struct FrametimeGraphWindow : Window {
|
||||||
{ TIMESTAMP_PRECISION * 3, 4 },
|
{ TIMESTAMP_PRECISION * 3, 4 },
|
||||||
{ TIMESTAMP_PRECISION * 1, 2 },
|
{ TIMESTAMP_PRECISION * 1, 2 },
|
||||||
};
|
};
|
||||||
for (const ScaleDef *sc = hscales; sc < hscales + lengthof(hscales); sc++) {
|
for (const auto &sc : hscales) {
|
||||||
if (range < sc->range) this->horizontal_scale = sc->scale;
|
if (range < sc.range) this->horizontal_scale = sc.scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,8 +836,8 @@ struct FrametimeGraphWindow : Window {
|
||||||
TIMESTAMP_PRECISION / 50,
|
TIMESTAMP_PRECISION / 50,
|
||||||
TIMESTAMP_PRECISION / 200,
|
TIMESTAMP_PRECISION / 200,
|
||||||
};
|
};
|
||||||
for (const TimingMeasurement *sc = vscales; sc < vscales + lengthof(vscales); sc++) {
|
for (const auto &sc : vscales) {
|
||||||
if (range < *sc) this->vertical_scale = (int)*sc;
|
if (range < sc) this->vertical_scale = (int)sc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,11 +1070,11 @@ void ConPrintFramerate()
|
||||||
|
|
||||||
bool printed_anything = false;
|
bool printed_anything = false;
|
||||||
|
|
||||||
for (const PerformanceElement *e = rate_elements; e < rate_elements + lengthof(rate_elements); e++) {
|
for (const auto &e : rate_elements) {
|
||||||
auto &pf = _pf_data[*e];
|
auto &pf = _pf_data[e];
|
||||||
if (pf.num_valid == 0) continue;
|
if (pf.num_valid == 0) continue;
|
||||||
IConsolePrint(TC_GREEN, "{} rate: {:.2f}fps (expected: {:.2f}fps)",
|
IConsolePrint(TC_GREEN, "{} rate: {:.2f}fps (expected: {:.2f}fps)",
|
||||||
MEASUREMENT_NAMES[*e],
|
MEASUREMENT_NAMES[e],
|
||||||
pf.GetRate(),
|
pf.GetRate(),
|
||||||
pf.expected_rate);
|
pf.expected_rate);
|
||||||
printed_anything = true;
|
printed_anything = true;
|
||||||
|
|
Loading…
Reference in New Issue