mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Merge pull request #8958 from dobrykafe/pr-filter-skin-parts
Make 0.7 skin filter apply to skin parts
This commit is contained in:
commit
0a3a095479
|
@ -252,6 +252,7 @@ protected:
|
|||
int m_TeePartSelected = protocol7::SKINPART_BODY;
|
||||
const CSkins7::CSkin *m_pSelectedSkin = nullptr;
|
||||
CLineInputBuffered<protocol7::MAX_SKIN_ARRAY_SIZE, protocol7::MAX_SKIN_LENGTH> m_SkinNameInput;
|
||||
bool m_SkinPartListNeedsUpdate = false;
|
||||
void PopupConfirmDeleteSkin7();
|
||||
|
||||
// for map download popup
|
||||
|
|
|
@ -218,6 +218,7 @@ void CMenus::RenderSettingsTee7(CUIRect MainView)
|
|||
if(Ui()->DoEditBox_Search(&s_SkinFilterInput, &QuickSearch, 14.0f, !Ui()->IsPopupOpen() && m_pClient->m_GameConsole.IsClosed()))
|
||||
{
|
||||
m_SkinListNeedsUpdate = true;
|
||||
m_SkinPartListNeedsUpdate = true;
|
||||
}
|
||||
|
||||
static CButtonContainer s_DirectoryButton;
|
||||
|
@ -413,17 +414,21 @@ void CMenus::RenderSkinSelection7(CUIRect MainView)
|
|||
|
||||
void CMenus::RenderSkinPartSelection7(CUIRect MainView)
|
||||
{
|
||||
static bool s_InitSkinPartList = true;
|
||||
static std::vector<const CSkins7::CSkinPart *> s_paList[protocol7::NUM_SKINPARTS];
|
||||
static CListBox s_ListBox;
|
||||
if(s_InitSkinPartList)
|
||||
static int s_aSkinPartCount[protocol7::NUM_SKINPARTS] = {0};
|
||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||
{
|
||||
for(int Part = 0; Part < protocol7::NUM_SKINPARTS; Part++)
|
||||
if(m_SkinPartListNeedsUpdate || m_pClient->m_Skins7.NumSkinPart(Part) != s_aSkinPartCount[Part])
|
||||
{
|
||||
s_paList[Part].clear();
|
||||
for(int i = 0; i < m_pClient->m_Skins7.NumSkinPart(Part); ++i)
|
||||
s_aSkinPartCount[Part] = m_pClient->m_Skins7.NumSkinPart(Part);
|
||||
for(int i = 0; i < s_aSkinPartCount[Part]; ++i)
|
||||
{
|
||||
const CSkins7::CSkinPart *pPart = m_pClient->m_Skins7.GetSkinPart(Part, i);
|
||||
if(g_Config.m_ClSkinFilterString[0] != '\0' && !str_utf8_find_nocase(pPart->m_aName, g_Config.m_ClSkinFilterString))
|
||||
continue;
|
||||
|
||||
// no special skins
|
||||
if((pPart->m_Flags & CSkins7::SKINFLAG_SPECIAL) == 0)
|
||||
{
|
||||
|
@ -431,8 +436,8 @@ void CMenus::RenderSkinPartSelection7(CUIRect MainView)
|
|||
}
|
||||
}
|
||||
}
|
||||
s_InitSkinPartList = false;
|
||||
}
|
||||
m_SkinPartListNeedsUpdate = false;
|
||||
|
||||
static int s_OldSelected = -1;
|
||||
s_ListBox.DoBegin(&MainView);
|
||||
|
|
Loading…
Reference in a new issue