From b0db610a47b6b65b9967ada03e71fa949ec7a1c4 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Sat, 9 Jan 2021 23:40:17 +0300 Subject: [PATCH] Entities: Get rid of direct m_ID access --- src/game/server/entities/door.cpp | 2 +- src/game/server/entities/dragger.cpp | 2 +- src/game/server/entities/gun.cpp | 2 +- src/game/server/entities/laser.cpp | 2 +- src/game/server/entities/light.cpp | 2 +- src/game/server/entities/pickup.cpp | 2 +- src/game/server/entities/plasma.cpp | 2 +- src/game/server/entities/projectile.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/server/entities/door.cpp b/src/game/server/entities/door.cpp index 7a6289c49..3161b61fd 100644 --- a/src/game/server/entities/door.cpp +++ b/src/game/server/entities/door.cpp @@ -66,7 +66,7 @@ void CDoor::Snap(int SnappingClient) return; CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem( - NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); + NETOBJTYPE_LASER, GetID(), sizeof(CNetObj_Laser))); if(!pObj) return; diff --git a/src/game/server/entities/dragger.cpp b/src/game/server/entities/dragger.cpp index bfd029451..6f154ed5f 100644 --- a/src/game/server/entities/dragger.cpp +++ b/src/game/server/entities/dragger.cpp @@ -225,7 +225,7 @@ void CDragger::Snap(int SnappingClient) if(i == -1) { obj = static_cast(Server()->SnapNewItem( - NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); + NETOBJTYPE_LASER, GetID(), sizeof(CNetObj_Laser))); } else { diff --git a/src/game/server/entities/gun.cpp b/src/game/server/entities/gun.cpp index 16968f741..e14114856 100644 --- a/src/game/server/entities/gun.cpp +++ b/src/game/server/entities/gun.cpp @@ -123,7 +123,7 @@ void CGun::Snap(int SnappingClient) int Tick = (Server()->Tick() % Server()->TickSpeed()) % 11; if(Char && Char->IsAlive() && (m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()]) && (!Tick)) return; - CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); + CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, GetID(), sizeof(CNetObj_Laser))); if(!pObj) return; diff --git a/src/game/server/entities/laser.cpp b/src/game/server/entities/laser.cpp index 5ed824b2e..5db085482 100644 --- a/src/game/server/entities/laser.cpp +++ b/src/game/server/entities/laser.cpp @@ -275,7 +275,7 @@ void CLaser::Snap(int SnappingClient) if(!CmaskIsSet(TeamMask, SnappingClient)) return; - CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); + CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, GetID(), sizeof(CNetObj_Laser))); if(!pObj) return; diff --git a/src/game/server/entities/light.cpp b/src/game/server/entities/light.cpp index dba69583c..ea7dd78aa 100644 --- a/src/game/server/entities/light.cpp +++ b/src/game/server/entities/light.cpp @@ -115,7 +115,7 @@ void CLight::Snap(int SnappingClient) return; CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem( - NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); + NETOBJTYPE_LASER, GetID(), sizeof(CNetObj_Laser))); if(!pObj) return; diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index 6b3152767..bda0e1db8 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -166,7 +166,7 @@ void CPickup::Snap(int SnappingClient) return; int Size = Server()->IsSixup(SnappingClient) ? 3 * 4 : sizeof(CNetObj_Pickup); - CNetObj_Pickup *pP = static_cast(Server()->SnapNewItem(NETOBJTYPE_PICKUP, m_ID, Size)); + CNetObj_Pickup *pP = static_cast(Server()->SnapNewItem(NETOBJTYPE_PICKUP, GetID(), Size)); if(!pP) return; diff --git a/src/game/server/entities/plasma.cpp b/src/game/server/entities/plasma.cpp index 72135002a..dce8f72ba 100644 --- a/src/game/server/entities/plasma.cpp +++ b/src/game/server/entities/plasma.cpp @@ -104,7 +104,7 @@ void CPlasma::Snap(int SnappingClient) return; CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem( - NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); + NETOBJTYPE_LASER, GetID(), sizeof(CNetObj_Laser))); if(!pObj) return; diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index f59fb1727..13517b646 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -319,7 +319,7 @@ void CProjectile::Snap(int SnappingClient) if(m_Owner != -1 && !CmaskIsSet(TeamMask, SnappingClient)) return; - CNetObj_Projectile *pProj = static_cast(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_ID, sizeof(CNetObj_Projectile))); + CNetObj_Projectile *pProj = static_cast(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, GetID(), sizeof(CNetObj_Projectile))); if(pProj) { if(SnappingClient > -1 && GameServer()->m_apPlayers[SnappingClient] && GameServer()->m_apPlayers[SnappingClient]->GetClientVersion() >= VERSION_DDNET_ANTIPING_PROJECTILE)