MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / onUpdate

Function onUpdate

src/OpenLoco/src/Ui/Windows/TimePanel.cpp:386–416  ·  view source on GitHub ↗

0x00439AD9

Source from the content-addressed store, hash-verified

384
385 // 0x00439AD9
386 static void onUpdate(Window& w)
387 {
388 w.var_854 += 1;
389 if (w.var_854 >= 24)
390 {
391 w.var_854 = 0;
392 }
393
394 w.numTicksVisible += 1;
395 if (w.numTicksVisible >= kPausedStatusTextDuration * 2)
396 {
397 w.numTicksVisible = 0;
398 }
399
400 // Determine if the text needs to be updated
401 if (SceneManager::isPaused() && (SceneManager::getPauseFlags() & PauseFlags::browsePrompt) == PauseFlags::none)
402 {
403 if (w.numTicksVisible == 0 || w.numTicksVisible == kPausedStatusTextDuration)
404 {
405 redrawScheduled = true;
406 }
407 }
408
409 if (redrawScheduled)
410 {
411 redrawScheduled = false;
412
413 // Invalidating the inner frame widget effectively causes the entire time panel to be redrawn.
414 WindowManager::invalidateWidget(WindowType::timeToolbar, 0, Widx::inner_frame);
415 }
416 }
417
418 static constexpr WindowEventList kEvents = {
419 .onMouseUp = onMouseUp,

Callers

nothing calls this directly

Calls 3

getPauseFlagsFunction · 0.85
invalidateWidgetFunction · 0.85
isPausedFunction · 0.50

Tested by

no test coverage detected