diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp index 2444be415..8adf5150b 100644 --- a/src/game/client/components/skins.cpp +++ b/src/game/client/components/skins.cpp @@ -249,7 +249,7 @@ int CSkins::FindImpl(const char *pName) LoadSkin(d.front().m_aName, aPath, IStorage::TYPE_SAVE); d.front().m_pTask = nullptr; } - if(d.front().m_pTask && d.front().m_pTask->State() == HTTP_ERROR) + if(d.front().m_pTask && (d.front().m_pTask->State() == HTTP_ERROR || d.front().m_pTask->State() == HTTP_ABORTED)) { Storage()->RemoveFile(d.front().m_aPath, IStorage::TYPE_SAVE); d.front().m_pTask = nullptr; @@ -257,18 +257,8 @@ int CSkins::FindImpl(const char *pName) return -1; } - int DefaultIndex = CSkins::FindImpl("default"); - - // if default fails don't start any download - if(DefaultIndex == -1) - return -1; - CDownloadSkin Skin; str_copy(Skin.m_aName, pName, sizeof(Skin.m_aName)); - Skin.m_IsVanilla = false; - Skin.m_OrgTexture = m_aSkins[DefaultIndex].m_OrgTexture; - Skin.m_ColorTexture = m_aSkins[DefaultIndex].m_ColorTexture; - Skin.m_BloodColor = m_aSkins[DefaultIndex].m_BloodColor; char aUrl[256]; str_format(aUrl, sizeof(aUrl), "%s%s.png", g_Config.m_ClSkinDownloadUrl, pName); diff --git a/src/game/client/components/skins.h b/src/game/client/components/skins.h index 9d95b21f7..c0bf83f16 100644 --- a/src/game/client/components/skins.h +++ b/src/game/client/components/skins.h @@ -26,10 +26,15 @@ public: bool operator==(const char *pOther) { return !str_comp(m_aName, pOther); } }; - struct CDownloadSkin : public CSkin + struct CDownloadSkin { std::shared_ptr m_pTask; char m_aPath[MAX_PATH_LENGTH]; + char m_aName[24]; + + bool operator<(const CDownloadSkin &Other) { return str_comp(m_aName, Other.m_aName) < 0; } + bool operator<(const char *pOther) { return str_comp(m_aName, pOther) < 0; } + bool operator==(const char *pOther) { return !str_comp(m_aName, pOther); } }; void OnInit();