diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-16 20:37:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 20:37:58 +0100 |
commit | 7bdb2e79ed0c15d6d587fd170190890f5b9fdbb3 (patch) | |
tree | f6888fcb1130e0c1f9f7d0a6826abff36bdb71bf /src | |
parent | c9bcc12265dac91c5b213e4f5431ff23b644cef9 (diff) | |
download | openttd-7bdb2e79ed0c15d6d587fd170190890f5b9fdbb3.tar.xz |
Fix: framerate window showed a slightly higher rate than actually measured (#8682)
The first point was counted, but also initialized as "last". As
such, it didn't add to "total", but did add to "count", which made
the "count" 1 more than the total actually represents.
Diffstat (limited to 'src')
-rw-r--r-- | src/framerate_gui.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index c324fde2e..0afb533f6 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -151,6 +151,10 @@ namespace { /* Total duration covered by collected points */ TimingMeasurement total = 0; + /* We have nothing to compare the first point against */ + point--; + if (point < 0) point = NUM_FRAMERATE_POINTS - 1; + while (point != last_point) { /* Only record valid data points, but pretend the gaps in measurements aren't there */ if (this->durations[point] != INVALID_DURATION) { |