mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add popup to confirm connecting to friend on non-official server
This commit is contained in:
parent
1bea7a2cd5
commit
2e46460302
|
@ -7,6 +7,7 @@
|
|||
#include <base/vmath.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
|
@ -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<bool> Official = {});
|
||||
void PopupConfirmSwitchServer();
|
||||
void RenderServerbrowserServerDetail(CUIRect View);
|
||||
void RenderServerbrowserFilters(CUIRect View);
|
||||
|
|
|
@ -585,9 +585,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
}
|
||||
}
|
||||
|
||||
void CMenus::Connect(const char *pAddress)
|
||||
void CMenus::Connect(const char *pAddress, std::optional<bool> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue