From bf9e8a430959ceacb36085ac4220fb5cae513dde Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Mon, 5 Dec 2022 20:02:07 +0100 Subject: [PATCH] Check if ghost is really used bcs IntsToStr returns weird stuff for 0 integers --- src/game/client/components/ghost.cpp | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/game/client/components/ghost.cpp b/src/game/client/components/ghost.cpp index aefb66e1f..101dee6b5 100644 --- a/src/game/client/components/ghost.cpp +++ b/src/game/client/components/ghost.cpp @@ -672,10 +672,26 @@ void CGhost::RefindSkin() char aSkinName[64]; for(auto &Ghost : m_aActiveGhosts) { - IntsToStr(&Ghost.m_Skin.m_Skin0, 6, aSkinName); + if(!Ghost.Empty()) + { + IntsToStr(&Ghost.m_Skin.m_Skin0, 6, aSkinName); + if(aSkinName[0] != '\0') + { + CTeeRenderInfo *pRenderInfo = &Ghost.m_RenderInfo; + + const CSkin *pSkin = m_pClient->m_Skins.Find(aSkinName); + pRenderInfo->m_OriginalRenderSkin = pSkin->m_OriginalSkin; + pRenderInfo->m_ColorableRenderSkin = pSkin->m_ColorableSkin; + pRenderInfo->m_SkinMetrics = pSkin->m_Metrics; + } + } + } + if(!m_CurGhost.Empty()) + { + IntsToStr(&m_CurGhost.m_Skin.m_Skin0, 6, aSkinName); if(aSkinName[0] != '\0') { - CTeeRenderInfo *pRenderInfo = &Ghost.m_RenderInfo; + CTeeRenderInfo *pRenderInfo = &m_CurGhost.m_RenderInfo; const CSkin *pSkin = m_pClient->m_Skins.Find(aSkinName); pRenderInfo->m_OriginalRenderSkin = pSkin->m_OriginalSkin; @@ -683,14 +699,4 @@ void CGhost::RefindSkin() pRenderInfo->m_SkinMetrics = pSkin->m_Metrics; } } - IntsToStr(&m_CurGhost.m_Skin.m_Skin0, 6, aSkinName); - if(aSkinName[0] != '\0') - { - CTeeRenderInfo *pRenderInfo = &m_CurGhost.m_RenderInfo; - - const CSkin *pSkin = m_pClient->m_Skins.Find(aSkinName); - pRenderInfo->m_OriginalRenderSkin = pSkin->m_OriginalSkin; - pRenderInfo->m_ColorableRenderSkin = pSkin->m_ColorableSkin; - pRenderInfo->m_SkinMetrics = pSkin->m_Metrics; - } }