Merge pull request #7576 from furo321/favourite-with-prefix

Fix bug when using favourites in combination with prefixes.
This commit is contained in:
Dennis Felsing 2023-12-02 22:35:30 +00:00 committed by GitHub
commit 07fd8c1a48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -745,7 +745,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
for(const auto &it : m_SkinFavorites)
{
const CSkin *pSkinToBeSelected = m_pClient->m_Skins.FindOrNullptr(it.c_str());
const CSkin *pSkinToBeSelected = m_pClient->m_Skins.FindOrNullptr(it.c_str(), true);
if(pSkinToBeSelected == nullptr || !SkinNotFiltered(pSkinToBeSelected))
continue;

View file

@ -373,14 +373,14 @@ const CSkin *CSkins::Find(const char *pName)
}
}
const CSkin *CSkins::FindOrNullptr(const char *pName)
const CSkin *CSkins::FindOrNullptr(const char *pName, bool IgnorePrefix)
{
const char *pSkinPrefix = m_aEventSkinPrefix[0] ? m_aEventSkinPrefix : g_Config.m_ClSkinPrefix;
if(g_Config.m_ClVanillaSkinsOnly && !IsVanillaSkin(pName))
{
return nullptr;
}
else if(pSkinPrefix && pSkinPrefix[0])
else if(pSkinPrefix && pSkinPrefix[0] && !IgnorePrefix)
{
char aBuf[24];
str_format(aBuf, sizeof(aBuf), "%s_%s", pSkinPrefix, pName);

View file

@ -64,7 +64,7 @@ public:
void Refresh(TSkinLoadedCBFunc &&SkinLoadedFunc);
int Num();
std::unordered_map<std::string_view, std::unique_ptr<CSkin>> &GetSkinsUnsafe() { return m_Skins; }
const CSkin *FindOrNullptr(const char *pName);
const CSkin *FindOrNullptr(const char *pName, bool IgnorePrefix = false);
const CSkin *Find(const char *pName);
bool IsDownloadingSkins() { return m_DownloadingSkins; }