mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Merge pull request #2023 from Fudgyking/show-spec-votes
Show votes in spec with a message indicating that you cannot vote
This commit is contained in:
commit
6e8133fe79
|
@ -605,9 +605,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
||||||
const char *pNotification = 0;
|
const char *pNotification = 0;
|
||||||
char aBuf[64];
|
char aBuf[64];
|
||||||
|
|
||||||
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team == TEAM_SPECTATORS)
|
if(m_pClient->m_pVoting->IsVoting())
|
||||||
pNotification = Localize("Spectators aren't allowed to start a vote.");
|
|
||||||
else if(m_pClient->m_pVoting->IsVoting())
|
|
||||||
pNotification = Localize("Wait for current vote to end before calling a new one.");
|
pNotification = Localize("Wait for current vote to end before calling a new one.");
|
||||||
else if(m_pClient->m_pVoting->CallvoteBlockTime() != 0)
|
else if(m_pClient->m_pVoting->CallvoteBlockTime() != 0)
|
||||||
{
|
{
|
||||||
|
@ -679,6 +677,9 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team == TEAM_SPECTATORS)
|
||||||
|
pNotification = Localize("Spectators aren't allowed to start a vote.");
|
||||||
|
|
||||||
// render background
|
// render background
|
||||||
MainView.HSplitBottom(90.0f+2*20.0f, &MainView, &Extended);
|
MainView.HSplitBottom(90.0f+2*20.0f, &MainView, &Extended);
|
||||||
RenderTools()->DrawUIRect(&Extended, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&Extended, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
@ -686,7 +687,8 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
||||||
bool doCallVote = false;
|
bool doCallVote = false;
|
||||||
// render page
|
// render page
|
||||||
if(s_ControlPage == 0)
|
if(s_ControlPage == 0)
|
||||||
doCallVote = RenderServerControlServer(MainView); // double click triggers vote
|
// double click triggers vote if not spectating
|
||||||
|
doCallVote = RenderServerControlServer(MainView) && m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_SPECTATORS;
|
||||||
else if(s_ControlPage == 1)
|
else if(s_ControlPage == 1)
|
||||||
RenderServerControlKick(MainView, false);
|
RenderServerControlKick(MainView, false);
|
||||||
else if(s_ControlPage == 2)
|
else if(s_ControlPage == 2)
|
||||||
|
@ -697,6 +699,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
||||||
Extended.HSplitTop(20.0f, &Note, &Extended);
|
Extended.HSplitTop(20.0f, &Note, &Extended);
|
||||||
Extended.HSplitTop(20.0f, &Bottom, &Extended);
|
Extended.HSplitTop(20.0f, &Bottom, &Extended);
|
||||||
{
|
{
|
||||||
|
if(Authed || m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team != TEAM_SPECTATORS){
|
||||||
Bottom.VSplitRight(120.0f, &Bottom, &Button);
|
Bottom.VSplitRight(120.0f, &Bottom, &Button);
|
||||||
|
|
||||||
// render kick reason
|
// render kick reason
|
||||||
|
@ -723,6 +726,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
||||||
if(UI()->DoButtonLogic(s_ClearButton.GetID(), "x", 0, &ClearButton))
|
if(UI()->DoButtonLogic(s_ClearButton.GetID(), "x", 0, &ClearButton))
|
||||||
m_aCallvoteReason[0] = 0;
|
m_aCallvoteReason[0] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(pNotification == 0)
|
if(pNotification == 0)
|
||||||
{
|
{
|
||||||
|
@ -731,10 +735,10 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
||||||
if(DoButton_Menu(&s_CallVoteButton, Localize("Call vote"), 0, &Button) || doCallVote)
|
if(DoButton_Menu(&s_CallVoteButton, Localize("Call vote"), 0, &Button) || doCallVote)
|
||||||
HandleCallvote(s_ControlPage, false);
|
HandleCallvote(s_ControlPage, false);
|
||||||
}
|
}
|
||||||
else
|
else if (!Authed)
|
||||||
{
|
{
|
||||||
// print notice
|
// print notice
|
||||||
UI()->DoLabel(&Note, pNotification, Note.h*ms_FontmodHeight*0.8f, CUI::ALIGN_LEFT, Note.w);
|
UI()->DoLabel(&Note, pNotification, Note.h*ms_FontmodHeight*0.8f, CUI::ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// extended features (only available when authed in rcon)
|
// extended features (only available when authed in rcon)
|
||||||
|
|
Loading…
Reference in a new issue