| 585 | } |
| 586 | |
| 587 | void NetworkBase::TickClient() |
| 588 | { |
| 589 | assert(_serverConnection != nullptr); |
| 590 | |
| 591 | switch (status) |
| 592 | { |
| 593 | case Status::connecting: |
| 594 | { |
| 595 | switch (_serverConnection->socket->GetStatus()) |
| 596 | { |
| 597 | case SocketStatus::resolving: |
| 598 | { |
| 599 | if (_lastConnectStatus != SocketStatus::resolving) |
| 600 | { |
| 601 | _lastConnectStatus = SocketStatus::resolving; |
| 602 | char str_resolving[256]; |
| 603 | FormatStringLegacy(str_resolving, 256, STR_MULTIPLAYER_RESOLVING, nullptr); |
| 604 | |
| 605 | auto intent = Intent(WindowClass::networkStatus); |
| 606 | intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_resolving }); |
| 607 | intent.PutExtra( |
| 608 | INTENT_EXTRA_CALLBACK, []() -> void { OpenRCT2::GetContext()->GetNetwork().Close(); }); |
| 609 | ContextOpenIntent(&intent); |
| 610 | } |
| 611 | break; |
| 612 | } |
| 613 | case SocketStatus::connecting: |
| 614 | { |
| 615 | if (_lastConnectStatus != SocketStatus::connecting) |
| 616 | { |
| 617 | _lastConnectStatus = SocketStatus::connecting; |
| 618 | char str_connecting[256]; |
| 619 | FormatStringLegacy(str_connecting, 256, STR_MULTIPLAYER_CONNECTING, nullptr); |
| 620 | |
| 621 | auto intent = Intent(WindowClass::networkStatus); |
| 622 | intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_connecting }); |
| 623 | intent.PutExtra( |
| 624 | INTENT_EXTRA_CALLBACK, []() -> void { OpenRCT2::GetContext()->GetNetwork().Close(); }); |
| 625 | ContextOpenIntent(&intent); |
| 626 | |
| 627 | server_connect_time = Platform::GetTicks(); |
| 628 | } |
| 629 | break; |
| 630 | } |
| 631 | case SocketStatus::connected: |
| 632 | { |
| 633 | status = Status::connected; |
| 634 | Client_Send_TOKEN(); |
| 635 | char str_authenticating[256]; |
| 636 | FormatStringLegacy(str_authenticating, 256, STR_MULTIPLAYER_AUTHENTICATING, nullptr); |
| 637 | |
| 638 | auto intent = Intent(WindowClass::networkStatus); |
| 639 | intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_authenticating }); |
| 640 | intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { OpenRCT2::GetContext()->GetNetwork().Close(); }); |
| 641 | ContextOpenIntent(&intent); |
| 642 | break; |
| 643 | } |
| 644 | default: |
nothing calls this directly
no test coverage detected