MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / UpdateData

Method UpdateData

src/framerate_gui.cpp:465–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463 }};
464
465 void UpdateData()
466 {
467 double gl_rate = _pf_data[PFE_GAMELOOP].GetRate();
468 this->rate_gameloop.SetRate(gl_rate, _pf_data[PFE_GAMELOOP].expected_rate);
469 this->speed_gameloop.SetRate(gl_rate / _pf_data[PFE_GAMELOOP].expected_rate, 1.0);
470 if (this->IsShaded()) return; // in small mode, this is everything needed
471
472 this->rate_drawing.SetRate(_pf_data[PFE_DRAWING].GetRate(), _settings_client.gui.refresh_rate);
473
474 int new_active = 0;
475 for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) {
476 this->times_shortterm[e].SetTime(_pf_data[e].GetAverageDurationMilliseconds(8), MILLISECONDS_PER_TICK);
477 this->times_longterm[e].SetTime(_pf_data[e].GetAverageDurationMilliseconds(NUM_FRAMERATE_POINTS), MILLISECONDS_PER_TICK);
478 if (_pf_data[e].num_valid > 0) {
479 new_active++;
480 }
481 }
482
483 if (new_active != this->num_active) {
484 this->num_active = new_active;
485 Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
486 sb->SetCount(this->num_active);
487 sb->SetCapacity(std::min(this->num_displayed, this->num_active));
488 }
489 }
490
491 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
492 {

Callers 2

FramerateWindowMethod · 0.95
FramerateWindowClass · 0.95

Calls 8

GetRateMethod · 0.80
SetRateMethod · 0.80
IsShadedMethod · 0.80
SetTimeMethod · 0.80
GetScrollbarMethod · 0.80
SetCapacityMethod · 0.80
SetCountMethod · 0.45

Tested by

no test coverage detected