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

Method OnInvalidateData

src/signs_gui.cpp:302–313  ·  view source on GitHub ↗

* Some data on this window has become invalid. * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */

Source from the content-addressed store, hash-verified

300 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
301 */
302 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
303 {
304 /* When there is a filter string, we always need to rebuild the list even if
305 * the amount of signs in total is unchanged, as the subset of signs that is
306 * accepted by the filter might has changed. */
307 if (data == 0 || data == -1 || !this->string_filter.IsEmpty()) { // New or deleted sign, changed visibility setting or there is a filter string
308 /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
309 this->signs.ForceRebuild();
310 } else { // Change of sign contents while there is no filter string
311 this->signs.ForceResort();
312 }
313 }
314
315 /**
316 * Handler for global hotkeys of the SignListWindow.

Callers

nothing calls this directly

Calls 3

ForceRebuildMethod · 0.80
ForceResortMethod · 0.80
IsEmptyMethod · 0.45

Tested by

no test coverage detected