Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Client/core/CCommandFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ void CCommandFuncs::Reconnect(const char* szParameters)
// Start the connect
if (CCore::GetSingleton().GetConnectManager()->Reconnect(strHost.c_str(), usPort, strPassword.c_str(), false))
{
if (CCore::GetSingleton().GetConnectManager()->WasQuickConnect())
{
CCore::GetSingleton().GetConnectManager()->SetQuickConnect(false);
}
CCore::GetSingleton().GetConsole()->Printf(_("reconnect: Reconnecting to %s:%u..."), strHost.c_str(), usPort);
}
else
Expand Down
5 changes: 5 additions & 0 deletions Client/core/CConnectManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ class CConnectManager

bool Abort();

bool WasQuickConnect() const noexcept { return m_quickConnect; }

void DoPulse();

void OnServerExists();

void SetQuickConnect(bool quick) noexcept { m_quickConnect = quick; }

static void OpenServerFirewall(in_addr Address, ushort usHttpPort = 80, bool bHighPriority = false);

static bool StaticProcessPacket(unsigned char ucPacketID, class NetBitStreamInterface& bitStream);
Expand Down Expand Up @@ -59,4 +63,5 @@ class CConnectManager
bool m_bNotifyServerBrowser;

bool CheckNickProvided(const char* szNick);
bool m_quickConnect{false};
};
9 changes: 8 additions & 1 deletion Client/core/CMainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,9 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
}

break;
case MENU_ITEM_QUICK_CONNECT:
AskUserIfHeWantsToDisconnect(m_pHoveredItem->menuType);
return true;
default:
break;
}
Expand Down Expand Up @@ -914,7 +917,8 @@ bool CMainMenu::OnQuickConnectButtonClick(CGUIElement* pElement, bool left)
ShowNetworkNotReadyWindow();
return true;
}


g_pCore->GetConnectManager()->SetQuickConnect(true);
g_pCore->GetCommands()->Execute("reconnect", "");
}
else
Expand Down Expand Up @@ -1262,6 +1266,9 @@ void CMainMenu::WantsToDisconnectCallBack(void* pData, uint uiButton)
case MENU_ITEM_DISCONNECT:
OnDisconnectButtonClick();
break;
case MENU_ITEM_QUICK_CONNECT:
OnQuickConnectButtonClick(nullptr, true);
break;
default:
break;
}
Expand Down