Merge pull request #7752 from Robyt3/Menus-Vote-Selection-Reset

Fix wrong selection in vote menu when selected player leaves
This commit is contained in:
Dennis Felsing 2024-01-02 17:39:26 +00:00 committed by GitHub
commit a8146afa77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -568,8 +568,8 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
{
int NumOptions = 0;
int Selected = 0;
static int aPlayerIDs[MAX_CLIENTS];
int Selected = -1;
int aPlayerIDs[MAX_CLIENTS];
for(const auto &pInfoByName : m_pClient->m_Snap.m_apInfoByName)
{
if(!pInfoByName)
@ -584,7 +584,8 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
if(m_CallvoteSelectedPlayer == Index)
Selected = NumOptions;
aPlayerIDs[NumOptions++] = Index;
aPlayerIDs[NumOptions] = Index;
NumOptions++;
}
static CListBox s_ListBox;