diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h
index ca024ba3e..69a7b1f92 100644
--- a/src/game/client/components/menus.h
+++ b/src/game/client/components/menus.h
@@ -7,6 +7,7 @@
#include
#include
+#include
#include
#include
@@ -562,7 +563,7 @@ protected:
// found in menus_browser.cpp
int m_SelectedIndex;
void RenderServerbrowserServerList(CUIRect View);
- void Connect(const char *pAddress);
+ void Connect(const char *pAddress, std::optional Official = {});
void PopupConfirmSwitchServer();
void RenderServerbrowserServerDetail(CUIRect View);
void RenderServerbrowserFilters(CUIRect View);
diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp
index 5dd302f3e..d9ba4c2e3 100644
--- a/src/game/client/components/menus_browser.cpp
+++ b/src/game/client/components/menus_browser.cpp
@@ -585,9 +585,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
}
}
-void CMenus::Connect(const char *pAddress)
+void CMenus::Connect(const char *pAddress, std::optional Official)
{
- if(Client()->State() == IClient::STATE_ONLINE && Client()->GetCurrentRaceTime() / 60 >= g_Config.m_ClConfirmDisconnectTime && g_Config.m_ClConfirmDisconnectTime >= 0)
+ if(Official.has_value() && !Official.value())
+ {
+ str_copy(m_aNextServer, pAddress);
+ PopupConfirm(Localize("Non-official server"), Localize("Are you sure that you want to connect to a non-official server?"), Localize("Yes"), Localize("No"), &CMenus::PopupConfirmSwitchServer);
+ }
+ else if(Client()->State() == IClient::STATE_ONLINE && Client()->GetCurrentRaceTime() / 60 >= g_Config.m_ClConfirmDisconnectTime && g_Config.m_ClConfirmDisconnectTime >= 0)
{
str_copy(m_aNextServer, pAddress);
PopupConfirm(Localize("Disconnect"), Localize("Are you sure that you want to disconnect and switch to a different server?"), Localize("Yes"), Localize("No"), &CMenus::PopupConfirmSwitchServer);
@@ -1509,7 +1514,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
str_copy(g_Config.m_UiServerAddress, Friend.ServerInfo()->m_aAddress);
if(Input()->MouseDoubleClick())
{
- Connect(g_Config.m_UiServerAddress);
+ Connect(g_Config.m_UiServerAddress, Friend.ServerInfo()->m_Official);
}
}
}