From a0c29e7dd67abb15c74c85f07741784877edfdcd Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Mon, 2 Sep 2013 11:39:10 -0700 Subject: General: * Fixed a variety of server browser issues with mods based on this SDK * Fixed many warnings on various platforms * Added source code for fgdlib and raytrace * Updated many source files with the latest shared source from TF2. OSX: * Added support for Xcode 4.6 * Switched OSX builds to use Xcode instead of makefiles * Moved libs from src/lib/osx32 to src/lib/public/osx32 or src/lib/common/osx32 to match windows better. Linux: * Moved libs from src/lib/linux32 to src/lib/public/linux32 or src/lib/common/linux32 to match windows better. --- mp/src/game/server/player.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'mp/src/game/server/player.h') diff --git a/mp/src/game/server/player.h b/mp/src/game/server/player.h index c17ff974..c1fa4f69 100644 --- a/mp/src/game/server/player.h +++ b/mp/src/game/server/player.h @@ -358,7 +358,7 @@ public: bool IsHLTV( void ) const { return pl.hltv; } bool IsReplay( void ) const { return pl.replay; } - virtual bool IsPlayer( void ) const { return true; } // Spectators return TRUE for this, use IsObserver to seperate cases + virtual bool IsPlayer( void ) const { return true; } // Spectators return TRUE for this, use IsObserver to separate cases virtual bool IsNetClient( void ) const { return true; } // Bots should return FALSE for this, they can't receive NET messages // Spectators should return TRUE for this @@ -1500,6 +1500,44 @@ int CollectPlayers( CUtlVector< T * > *playerVector, int team = TEAM_ANY, bool i return playerVector->Count(); } +template < typename T > +int CollectHumanPlayers( CUtlVector< T * > *playerVector, int team = TEAM_ANY, bool isAlive = false, bool shouldAppend = false ) +{ + if ( !shouldAppend ) + { + playerVector->RemoveAll(); + } + + for( int i=1; i<=gpGlobals->maxClients; ++i ) + { + CBasePlayer *player = UTIL_PlayerByIndex( i ); + + if ( player == NULL ) + continue; + + if ( FNullEnt( player->edict() ) ) + continue; + + if ( !player->IsPlayer() ) + continue; + + if ( player->IsBot() ) + continue; + + if ( !player->IsConnected() ) + continue; + + if ( team != TEAM_ANY && player->GetTeamNumber() != team ) + continue; + + if ( isAlive && !player->IsAlive() ) + continue; + + playerVector->AddToTail( assert_cast< T * >( player ) ); + } + + return playerVector->Count(); +} enum { -- cgit v1.2.3