Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/game/server/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include "econ_item_view.h"
#endif

#ifdef NEO
#include "team.h"
#endif

// For queuing and processing usercmds
class CCommandContext
{
Expand Down Expand Up @@ -1533,6 +1537,25 @@ int CollectPlayers( CUtlVector< T * > *playerVector, int team = TEAM_ANY, bool i
playerVector->RemoveAll();
}

#ifdef NEO
int estimatedCount = playerVector->Size();

const auto incrementEstimate = [&estimatedCount, isAlive](int team) {
const auto* pTeam = GetGlobalTeam(team);
Assert(pTeam);
if (pTeam)
estimatedCount += (isAlive ? pTeam->GetAliveMembers() : pTeam->GetNumPlayers());
};

if (team == TEAM_ANY)
{
const int nTeams = GetNumberOfTeams();
for (int i = 0; i < nTeams; ++i) incrementEstimate(i);
}
else incrementEstimate(team);
playerVector->EnsureCapacity(estimatedCount);
#endif

for( int i=1; i<=gpGlobals->maxClients; ++i )
{
CBasePlayer *player = UTIL_PlayerByIndex( i );
Expand Down