skip multiple skins during loading and prevent saving skin as special one

This commit is contained in:
oy 2015-03-22 13:15:18 +01:00
parent d0a028ae7e
commit fa8959311e
2 changed files with 4 additions and 2 deletions

View file

@ -2157,7 +2157,7 @@ int CMenus::Render()
static int s_ButtonTryAgain = 0; static int s_ButtonTryAgain = 0;
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), !m_aSaveSkinName[0], &Yes) || m_EnterPressed) if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), !m_aSaveSkinName[0], &Yes) || m_EnterPressed)
{ {
if(m_aSaveSkinName[0]) if(m_aSaveSkinName[0] && m_aSaveSkinName[0] != 'x' && m_aSaveSkinName[1] != '_')
{ {
m_Popup = POPUP_NONE; m_Popup = POPUP_NONE;
SaveSkinfile(); SaveSkinfile();

View file

@ -126,6 +126,9 @@ int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
// init // init
CSkin Skin = pSelf->m_DummySkin; CSkin Skin = pSelf->m_DummySkin;
str_copy(Skin.m_aName, pName, min((int)sizeof(Skin.m_aName),l-4));
if(pSelf->Find(Skin.m_aName, true) != -1)
return 0;
bool SpecialSkin = pName[0] == 'x' && pName[1] == '_'; bool SpecialSkin = pName[0] == 'x' && pName[1] == '_';
// parse json data // parse json data
@ -200,7 +203,6 @@ int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
Skin.m_Flags = SpecialSkin ? SKINFLAG_SPECIAL : 0; Skin.m_Flags = SpecialSkin ? SKINFLAG_SPECIAL : 0;
if(DirType != IStorage::TYPE_SAVE) if(DirType != IStorage::TYPE_SAVE)
Skin.m_Flags |= SKINFLAG_STANDARD; Skin.m_Flags |= SKINFLAG_STANDARD;
str_copy(Skin.m_aName, pName, min((int)sizeof(Skin.m_aName),l-4));
if(g_Config.m_Debug) if(g_Config.m_Debug)
{ {
str_format(aBuf, sizeof(aBuf), "load skin %s", Skin.m_aName); str_format(aBuf, sizeof(aBuf), "load skin %s", Skin.m_aName);