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.

92 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ICLIENT_H
  7. #define ICLIENT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <inetmsghandler.h>
  12. #include "tier0/platform.h"
  13. #include "userid.h"
  14. class IServer;
  15. class INetMessage;
  16. abstract_class IClient : public INetChannelHandler
  17. {
  18. public:
  19. virtual ~IClient() {}
  20. // connect client
  21. virtual void Connect(const char * szName, int nUserID, INetChannel *pNetChannel, bool bFakePlayer, int clientChallenge ) = 0;
  22. // set the client in a pending state waiting for a new game
  23. virtual void Inactivate( void ) = 0;
  24. // Reconnect without dropiing the netchannel
  25. virtual void Reconnect( void ) = 0; // froce reconnect
  26. // disconnects a client with a given reason
  27. virtual void Disconnect( PRINTF_FORMAT_STRING const char *reason, ... ) = 0;
  28. virtual int GetPlayerSlot() const = 0; // returns client slot (usually entity number-1)
  29. virtual int GetUserID() const = 0; // unique ID on this server
  30. virtual const USERID_t GetNetworkID() const = 0; // network wide ID
  31. virtual const char *GetClientName() const = 0; // returns client name
  32. virtual INetChannel *GetNetChannel() = 0; // returns client netchannel
  33. virtual IServer *GetServer() = 0; // returns the object server the client belongs to
  34. virtual const char *GetUserSetting(const char *cvar) const = 0; // returns a clients FCVAR_USERINFO setting
  35. virtual const char *GetNetworkIDString() const = 0; // returns a human readable representation of the network id
  36. // set/get client data rate in bytes/second
  37. virtual void SetRate( int nRate, bool bForce ) = 0;
  38. virtual int GetRate( void ) const = 0;
  39. // set/get updates/second rate
  40. virtual void SetUpdateRate( int nUpdateRate, bool bForce ) = 0;
  41. virtual int GetUpdateRate( void ) const = 0;
  42. // clear complete object & free all memory
  43. virtual void Clear( void ) = 0;
  44. // returns the highest world tick number acknowledge by client
  45. virtual int GetMaxAckTickCount() const = 0;
  46. // execute a client command
  47. virtual bool ExecuteStringCommand( const char *s ) = 0;
  48. // send client a network message
  49. virtual bool SendNetMsg(INetMessage &msg, bool bForceReliable = false) = 0;
  50. // send client a text message
  51. virtual void ClientPrintf (PRINTF_FORMAT_STRING const char *fmt, ...) = 0;
  52. // client has established network channels, nothing else
  53. virtual bool IsConnected( void ) const = 0;
  54. // client is downloading signon data
  55. virtual bool IsSpawned( void ) const = 0;
  56. // client active is ingame, receiving snapshots
  57. virtual bool IsActive( void ) const = 0;
  58. // returns true, if client is not a real player
  59. virtual bool IsFakeClient( void ) const = 0;
  60. // returns true, if client is a HLTV proxy
  61. virtual bool IsHLTV( void ) const = 0;
  62. #if defined( REPLAY_ENABLED )
  63. // returns true, if client is a Replay proxy
  64. virtual bool IsReplay( void ) const = 0;
  65. #else
  66. // !KLUDGE! Reduce number of #ifdefs required
  67. inline bool IsReplay( void ) const { return false; }
  68. #endif
  69. // returns true, if client hears this player
  70. virtual bool IsHearingClient(int index) const = 0;
  71. // returns true, if client hears this player by proximity
  72. virtual bool IsProximityHearingClient(int index) const = 0;
  73. virtual void SetMaxRoutablePayloadSize( int nMaxRoutablePayloadSize ) = 0;
  74. };
  75. #endif // ICLIENT_H