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

Method OnInvalidateData

src/group_gui.cpp:531–554  ·  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

529 * @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.
530 */
531 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
532 {
533 if (data == 0) {
534 /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
535 this->vehgroups.ForceRebuild();
536 this->groups.ForceRebuild();
537 } else {
538 this->vehgroups.ForceResort();
539 this->groups.ForceResort();
540 }
541
542 /* Process ID-invalidation in command-scope as well */
543 if (this->group_rename != GroupID::Invalid() && !Group::IsValidID(this->group_rename)) {
544 CloseWindowByClass(WC_QUERY_STRING);
545 this->group_rename = GroupID::Invalid();
546 }
547
548 GroupID group = this->vli.ToGroupID();
549 if (!(IsAllGroupID(group) || IsDefaultGroupID(group) || Group::IsValidID(group))) {
550 this->vli.SetIndex(ALL_GROUP);
551 this->CloseChildWindows(WC_DROPDOWN_MENU);
552 }
553 this->SetDirty();
554 }
555
556 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
557 {

Callers

nothing calls this directly

Calls 10

InvalidFunction · 0.85
CloseWindowByClassFunction · 0.85
IsAllGroupIDFunction · 0.85
IsDefaultGroupIDFunction · 0.85
ForceRebuildMethod · 0.80
ForceResortMethod · 0.80
ToGroupIDMethod · 0.80
CloseChildWindowsMethod · 0.80
SetIndexMethod · 0.45
SetDirtyMethod · 0.45

Tested by

no test coverage detected