mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Don't add duplicate skins (fixes #102)
This commit is contained in:
parent
4b3dd81a74
commit
a840df5635
|
@ -34,10 +34,20 @@ int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
CSkins *pSelf = (CSkins *)pUser;
|
CSkins *pSelf = (CSkins *)pUser;
|
||||||
|
|
||||||
int l = str_length(pName);
|
int l = str_length(pName);
|
||||||
if(l < 4 || IsDir || str_comp(pName+l-4, ".png") != 0)
|
if(l < 4 || IsDir || str_comp(pName+l-4, ".png") != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Don't add duplicate skins (one from user's config directory, other from
|
||||||
|
// client itself)
|
||||||
|
for(int i = 0; i < pSelf->Num(); i++)
|
||||||
|
{
|
||||||
|
const char* pExName = pSelf->Get(i)->m_aName;
|
||||||
|
if(str_comp_num(pExName, pName, l-4) == 0 && str_length(pExName) == l-4)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
char aBuf[512];
|
char aBuf[512];
|
||||||
str_format(aBuf, sizeof(aBuf), "skins/%s", pName);
|
str_format(aBuf, sizeof(aBuf), "skins/%s", pName);
|
||||||
CImageInfo Info;
|
CImageInfo Info;
|
||||||
|
|
Loading…
Reference in a new issue