* 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. */
| 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. */ |