Skip to content

Commit

Permalink
Fix wrong server address used in password popup when redirected
Browse files Browse the repository at this point in the history
Always use the server address from the network client to reconnect to the correct server after being disconnected due to wrong password. The password popup is only shown after being disconnected, so the server address of the network client should always the address of the server which the client should reconnect to with the password. Using `ui_server_address` was causing the wrong address to be used after being redirected to another server and if the config variable is changed while the password popup is open.

Closes ddnet#8260.
  • Loading branch information
Robyt3 committed Apr 28, 2024
1 parent d2139e4 commit 938d264
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/client/components/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,9 @@ void CMenus::RenderPopupFullscreen(CUIRect Screen)
static CButtonContainer s_ButtonTryAgain;
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Try again"), 0, &TryAgain) || Ui()->ConsumeHotkey(CUi::HOTKEY_ENTER))
{
Client()->Connect(g_Config.m_UiServerAddress, g_Config.m_Password);
char aAddr[NETADDR_MAXSTRSIZE];
net_addr_str(&Client()->ServerAddress(), aAddr, sizeof(aAddr), true);
Client()->Connect(aAddr, g_Config.m_Password);
}

Box.HSplitBottom(60.f, &Box, &Part);
Expand Down

0 comments on commit 938d264

Please sign in to comment.