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

Method OnInvalidateData

src/script/script_gui.cpp:230–243  ·  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

228 * @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.
229 */
230 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
231 {
232 if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
233 this->Close();
234 return;
235 }
236
237 if (!gui_scope) return;
238
239 this->vscroll->SetCount(this->info_list->size() + 1);
240
241 /* selected goes from -1 .. length of ai list - 1. */
242 this->selected = std::min(this->selected, this->vscroll->GetCount() - 2);
243 }
244};
245
246/** Widgets for the AI list window. */

Callers

nothing calls this directly

Calls 4

CloseMethod · 0.45
SetCountMethod · 0.45
sizeMethod · 0.45
GetCountMethod · 0.45

Tested by

no test coverage detected