Actually disconnect dummy after confirmation (fixes #1555)

This commit is contained in:
def 2019-03-30 16:59:25 +01:00
parent 0b578c4330
commit c0d3f5fa57
3 changed files with 35 additions and 1 deletions

View file

@ -1174,6 +1174,12 @@ int CMenus::Render()
pExtraText = Localize("Are you sure that you want to disconnect?");
ExtraAlign = -1;
}
else if(m_Popup == POPUP_DISCONNECT_DUMMY)
{
pTitle = Localize("Disconnect Dummy");
pExtraText = Localize("Are you sure that you want to disconnect your dummy?");
ExtraAlign = -1;
}
else if(m_Popup == POPUP_FIRST_LAUNCH)
{
pTitle = Localize("Welcome to DDNet");
@ -1272,6 +1278,33 @@ int CMenus::Render()
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed)
Client()->Disconnect();
}
else if(m_Popup == POPUP_DISCONNECT_DUMMY)
{
CUIRect Yes, No;
Box.HSplitBottom(20.f, &Box, &Part);
#if defined(__ANDROID__)
Box.HSplitBottom(60.f, &Box, &Part);
#else
Box.HSplitBottom(24.f, &Box, &Part);
#endif
// buttons
Part.VMargin(80.0f, &Part);
Part.VSplitMid(&No, &Yes);
Yes.VMargin(20.0f, &Yes);
No.VMargin(20.0f, &No);
static int s_ButtonAbort = 0;
if(DoButton_Menu(&s_ButtonAbort, Localize("No"), 0, &No) || m_EscapePressed)
m_Popup = POPUP_NONE;
static int s_ButtonTryAgain = 0;
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed)
{
Client()->DummyDisconnect(0);
m_Popup = POPUP_NONE;
}
}
else if(m_Popup == POPUP_PASSWORD)
{
CUIRect Label, TextBox, TryAgain, Abort;

View file

@ -400,6 +400,7 @@ public:
POPUP_PASSWORD,
POPUP_QUIT,
POPUP_DISCONNECT,
POPUP_DISCONNECT_DUMMY,
// demo player states
DEMOPLAYER_NONE=0,

View file

@ -155,7 +155,7 @@ void CMenus::RenderGame(CUIRect MainView)
{
if(Client()->GetCurrentRaceTime() / 60 >= g_Config.m_ClConfirmDisconnectTime && g_Config.m_ClConfirmDisconnectTime >= 0)
{
m_Popup = POPUP_DISCONNECT;
m_Popup = POPUP_DISCONNECT_DUMMY;
}
else
{