mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Reload skin menu when skin count changed
fixes graphics bug when new skins are added, skins array is reallocated and we accessed freed memory Thanks to Jupeyy & Learath2 for also looking into this
This commit is contained in:
parent
b3307dc2a6
commit
3276f2925d
|
@ -555,8 +555,9 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
MainView.HSplitTop(230.0f, &SkinList, &MainView);
|
MainView.HSplitTop(230.0f, &SkinList, &MainView);
|
||||||
static sorted_array<const CSkins::CSkin *> s_paSkinList;
|
static sorted_array<const CSkins::CSkin *> s_paSkinList;
|
||||||
|
static int s_SkinCount = 0;
|
||||||
static float s_ScrollValue = 0.0f;
|
static float s_ScrollValue = 0.0f;
|
||||||
if(s_InitSkinlist)
|
if(s_InitSkinlist || m_pClient->m_pSkins->Num() != s_SkinCount)
|
||||||
{
|
{
|
||||||
s_paSkinList.clear();
|
s_paSkinList.clear();
|
||||||
for(int i = 0; i < m_pClient->m_pSkins->Num(); ++i)
|
for(int i = 0; i < m_pClient->m_pSkins->Num(); ++i)
|
||||||
|
@ -575,9 +576,10 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
||||||
if (g_Config.m_ClVanillaSkinsOnly && !s->m_IsVanilla)
|
if (g_Config.m_ClVanillaSkinsOnly && !s->m_IsVanilla)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s_paSkinList.add(s);
|
s_paSkinList.add_unsorted(s);
|
||||||
}
|
}
|
||||||
s_InitSkinlist = false;
|
s_InitSkinlist = false;
|
||||||
|
s_SkinCount = m_pClient->m_pSkins->Num();
|
||||||
}
|
}
|
||||||
|
|
||||||
int OldSelected = -1;
|
int OldSelected = -1;
|
||||||
|
|
Loading…
Reference in a new issue