aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/player.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-09-02 11:39:10 -0700
committerJoe Ludwig <[email protected]>2013-09-02 11:39:10 -0700
commita0c29e7dd67abb15c74c85f07741784877edfdcd (patch)
tree35bd6b4580afa14648895b0f321d33a712a5d0fa /mp/src/game/server/player.h
parentAdded bloom shader and screenspace effect helpers as examples for the SDK. (diff)
downloadsource-sdk-2013-a0c29e7dd67abb15c74c85f07741784877edfdcd.tar.xz
source-sdk-2013-a0c29e7dd67abb15c74c85f07741784877edfdcd.zip
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.
Diffstat (limited to 'mp/src/game/server/player.h')
-rw-r--r--mp/src/game/server/player.h40
1 files changed, 39 insertions, 1 deletions
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
{