Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. #include "gcsdk/gcsdk_auto.h"
  8. #include "tf_lobby_server.h"
  9. using namespace GCSDK;
  10. const CTFLobbyMember* CTFGSLobby::GetMemberDetails( CSteamID steamID ) const
  11. {
  12. for ( int i = 0; i < Obj().members_size(); i++ )
  13. {
  14. if ( Obj().members( i ).id() == steamID.ConvertToUint64() )
  15. return &Obj().members( i );
  16. }
  17. return NULL;
  18. }
  19. const CTFLobbyMember* CTFGSLobby::GetMemberDetails( int i ) const
  20. {
  21. if ( !BAssertValidMemberIndex( i ) )
  22. return NULL;
  23. return &Obj().members( i );
  24. }
  25. const CSteamID CTFGSLobby::GetMember( int i ) const
  26. {
  27. Assert( i >= 0 && i < Obj().members_size() );
  28. if ( i < 0 || i >= Obj().members_size() )
  29. return k_steamIDNil;
  30. return Obj().members( i ).id();
  31. }
  32. CTFLobbyMember_ConnectState CTFGSLobby::GetMemberConnectState( int iMemberIndex ) const
  33. {
  34. if ( !BAssertValidMemberIndex( iMemberIndex ) )
  35. return CTFLobbyMember_ConnectState_INVALID;
  36. return Obj().members( iMemberIndex ).connect_state();
  37. }
  38. bool CTFGSLobby::BAssertValidMemberIndex( int iMemberIndex ) const
  39. {
  40. bool bValidMemberIndex = iMemberIndex >= 0 && iMemberIndex < Obj().members_size();
  41. Assert( bValidMemberIndex );
  42. return bValidMemberIndex;
  43. }
  44. void CTFGSLobby::SpewDebug()
  45. {
  46. Msg( "CTFGSLobby: ID:%016llx %d member(s) allow_spectators: %d\n", GetGroupID(), GetNumMembers(), Obj().allow_spectating() );
  47. for ( int i = 0; i < GetNumMembers(); i++ )
  48. {
  49. Msg( " Member[%d] %s team = %d\n", i, GetMember( i ).Render(), GetMemberDetails( i )->team() );
  50. }
  51. Msg(" Dump:\n" );
  52. Dump();
  53. }
  54. #ifdef USE_MVM_TOUR
  55. const char *CTFGSLobby::GetMannUpTourName() const
  56. {
  57. if ( !IsMannUpGroup( GetMatchGroup() ) )
  58. return NULL;
  59. return Obj().mannup_tour_name().c_str();
  60. }
  61. #endif // USE_MVM_TOUR