| 432 | |
| 433 | public: |
| 434 | NetworkGameWindow(WindowDesc &desc) : Window(desc), name_editbox(NETWORK_CLIENT_NAME_LENGTH), filter_editbox(120) |
| 435 | { |
| 436 | this->CreateNestedTree(); |
| 437 | this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR); |
| 438 | this->FinishInitNested(WN_NETWORK_WINDOW_GAME); |
| 439 | |
| 440 | this->querystrings[WID_NG_CLIENT] = &this->name_editbox; |
| 441 | this->name_editbox.text.Assign(_settings_client.network.client_name); |
| 442 | |
| 443 | this->querystrings[WID_NG_FILTER] = &this->filter_editbox; |
| 444 | this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; |
| 445 | this->SetFocusedWidget(WID_NG_FILTER); |
| 446 | |
| 447 | /* As the Game Coordinator doesn't support "websocket" servers yet, we |
| 448 | * let "os/emscripten/pre.js" hardcode a list of servers people can |
| 449 | * join. This means the serverlist is curated for now, but it is the |
| 450 | * best we can offer. */ |
| 451 | #ifdef __EMSCRIPTEN__ |
| 452 | EM_ASM(if (window["openttd_server_list"]) openttd_server_list()); |
| 453 | #endif |
| 454 | |
| 455 | this->last_joined = NetworkAddServer(_settings_client.network.last_joined, false); |
| 456 | this->server = this->last_joined; |
| 457 | |
| 458 | this->servers.SetListing(this->last_sorting); |
| 459 | this->servers.SetSortFuncs(NetworkGameWindow::sorter_funcs); |
| 460 | this->servers.SetFilterFuncs(NetworkGameWindow::filter_funcs); |
| 461 | this->servers.ForceRebuild(); |
| 462 | } |
| 463 | |
| 464 | ~NetworkGameWindow() |
| 465 | { |
nothing calls this directly
no test coverage detected