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

Function update

src/OpenLoco/src/Ui/WindowManager.cpp:109–141  ·  view source on GitHub ↗

0x004C6118

Source from the content-addressed store, hash-verified

107
108 // 0x004C6118
109 void update()
110 {
111 uint16_t timeSinceLastTick = getTimeSinceLastTick();
112 ToolTip::setNotShownTicks(ToolTip::getNotShownTicks() + timeSinceLastTick);
113
114 // 1000 tick update
115 _thousandthTickCounter += timeSinceLastTick;
116 if (_thousandthTickCounter >= 1000)
117 {
118 _thousandthTickCounter = 0;
119 std::for_each(_windows.rbegin(), _windows.rend(), [](Ui::Window& w) {
120 w.callOnPeriodicUpdate();
121 });
122 }
123
124 // Border flash invalidation
125 std::for_each(_windows.rbegin(), _windows.rend(), [](Ui::Window& w) {
126 if (w.hasFlags(WindowFlags::whiteBorderMask))
127 {
128 // TODO: Replace with countdown
129 // Countdown is stuffed into WindowFlags extract it out and decrement by 1
130 const auto newCount = enumValue(w.flags & WindowFlags::whiteBorderMask) - enumValue(WindowFlags::whiteBorderOne);
131 // Stuff the new count back into the WindowFlags
132 w.flags &= ~WindowFlags::whiteBorderMask;
133 w.flags |= static_cast<WindowFlags>(newCount);
134
135 if (!w.hasFlags(WindowFlags::whiteBorderMask))
136 {
137 w.invalidate();
138 }
139 }
140 });
141 }
142
143 // 0x00439BA5
144 void updateDaily()

Callers

nothing calls this directly

Calls 9

getTimeSinceLastTickFunction · 0.85
setNotShownTicksFunction · 0.85
getNotShownTicksFunction · 0.85
enumValueFunction · 0.85
rbeginMethod · 0.80
rendMethod · 0.80
callOnPeriodicUpdateMethod · 0.80
hasFlagsMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected