From 5fd247129c1cb12320713b93d37ccf4dad381752 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sun, 8 Feb 2026 09:05:24 +0100 Subject: [PATCH] Fix Item being shadowed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` /home/chiller/Desktop/git/ddnet_client/src/game/client/gameclient.cpp: In member function ‘void CGameClient::ProcessEvents()’: /home/chiller/Desktop/git/ddnet_client/src/game/client/gameclient.cpp:1451:66: warning: declaration of ‘Item’ shadows a previous local [-Wshadow] 1451 | const IClient::CSnapItem Item = Ent.m_Item; | ^~~~ /home/chiller/Desktop/git/ddnet_client/src/game/client/gameclient.cpp:1397:42: note: shadowed declaration is here 1397 | const IClient::CSnapItem Item = Client()->SnapGetItem(SnapType, Index); | ^~~~ At global scope: cc1plus: note: unrecognized command-line option ‘-Wno-nullability-completeness’ may have been intended to silence earlier diagnostics ``` --- src/game/client/gameclient.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index b96f343e2ef..a75761a36d0 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1448,12 +1448,12 @@ void CGameClient::ProcessEvents() bool IsShotgun = false; for(const CSnapEntities &Ent : SnapEntities()) { - const IClient::CSnapItem Item = Ent.m_Item; - const void *pData = Item.m_pData; + const IClient::CSnapItem EntItem = Ent.m_Item; + const void *pData = EntItem.m_pData; const CNetObj_EntityEx *pEntEx = Ent.m_pDataEx; - if(Item.m_Type == NETOBJTYPE_LASER || Item.m_Type == NETOBJTYPE_DDNETLASER) + if(EntItem.m_Type == NETOBJTYPE_LASER || EntItem.m_Type == NETOBJTYPE_DDNETLASER) { - CLaserData Data = ExtractLaserInfo(Item.m_Type, pData, &m_GameWorld, pEntEx); + CLaserData Data = ExtractLaserInfo(EntItem.m_Type, pData, &m_GameWorld, pEntEx); if (abs(Data.m_To.x - Pos.x) < 10 && abs(Data.m_To.y - Pos.y) < 10) { if(Data.m_Type == LASERTYPE_SHOTGUN) IsShotgun = true;