Iterate over m_AttachedPlayers instead of MAX_CLIENTS

This commit is contained in:
c0d3d3v 2022-05-22 21:43:31 +02:00
parent f07d773492
commit 5175734432
No known key found for this signature in database
GPG key ID: 068AF680530DFF31
2 changed files with 3 additions and 3 deletions

View file

@ -7,8 +7,8 @@
#include <base/system.h>
#include <map>
#include <vector>
#include <set>
#include <vector>
#include "collision.h"
#include <engine/shared/protocol.h>

View file

@ -1202,9 +1202,9 @@ void CCharacter::Snap(int SnappingClient)
bool AttachedHookInView = false;
if(PlayerAndHookNotInView)
{
for(int i = 0; i < MAX_CLIENTS; i++)
for(const auto &AttachedPlayerID : m_Core.m_AttachedPlayers)
{
CCharacter *OtherPlayer = GameServer()->GetPlayerChar(i);
CCharacter *OtherPlayer = GameServer()->GetPlayerChar(AttachedPlayerID);
if(OtherPlayer && OtherPlayer->m_Core.m_HookedPlayer == ID)
{
if(!NetworkClippedLine(SnappingClient, m_Pos, OtherPlayer->m_Pos))