From 532d845aedd804184146fe2b324f3fe7691b7c8e Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Mon, 2 Nov 2020 21:21:57 +0100 Subject: [PATCH] Fix skin load --- src/game/client/components/skins.cpp | 11 ++++------- src/game/client/components/skins.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp index df5faea22..7fc664c38 100644 --- a/src/game/client/components/skins.cpp +++ b/src/game/client/components/skins.cpp @@ -55,7 +55,7 @@ int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser) return pSelf->LoadSkin(aNameWithoutPng, aBuf, DirType); } -int CSkins::LoadSkin(const char *pName, const char *pPath, int DirType, int *pGetSkinID) +int CSkins::LoadSkin(const char *pName, const char *pPath, int DirType) { char aBuf[512]; CImageInfo Info; @@ -172,10 +172,8 @@ int CSkins::LoadSkin(const char *pName, const char *pPath, int DirType, int *pGe str_format(aBuf, sizeof(aBuf), "load skin %s", Skin.m_aName); Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "game", aBuf); } - m_aSkins.add(Skin); - if(pGetSkinID) - *pGetSkinID = m_aSkins.size() - 1; + m_aSkins.add(Skin); return 0; } @@ -293,20 +291,19 @@ int CSkins::FindImpl(const char *pName) auto d = ::find_binary(m_aDownloadSkins.all(), pName); if(!d.empty()) { - int SkinID = -1; if(d.front().m_pTask && d.front().m_pTask->State() == HTTP_DONE) { char aPath[MAX_PATH_LENGTH]; str_format(aPath, sizeof(aPath), "downloadedskins/%s.png", d.front().m_aName); Storage()->RenameFile(d.front().m_aPath, aPath, IStorage::TYPE_SAVE); - LoadSkin(d.front().m_aName, aPath, IStorage::TYPE_SAVE, &SkinID); + 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 || d.front().m_pTask->State() == HTTP_ABORTED)) { d.front().m_pTask = nullptr; } - return SkinID; + return -1; } CDownloadSkin Skin; diff --git a/src/game/client/components/skins.h b/src/game/client/components/skins.h index c1a56c343..4b6c35aff 100644 --- a/src/game/client/components/skins.h +++ b/src/game/client/components/skins.h @@ -35,7 +35,7 @@ private: sorted_array m_aDownloadSkins; char m_EventSkinPrefix[24]; - int LoadSkin(const char *pName, const char *pPath, int DirType, int *pGetSkinID = NULL); + int LoadSkin(const char *pName, const char *pPath, int DirType); int FindImpl(const char *pName); static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser); };