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.

68 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ISERVER_H
  7. #define ISERVER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <inetmsghandler.h>
  12. #include <bitvec.h>
  13. #include <const.h>
  14. class INetMessage;
  15. class IRecipientFilter;
  16. class IClient;
  17. typedef struct player_info_s player_info_t;
  18. abstract_class IServer : public IConnectionlessPacketHandler
  19. {
  20. public:
  21. virtual ~IServer() {}
  22. virtual int GetNumClients( void ) const = 0; // returns current number of clients
  23. virtual int GetNumProxies( void ) const = 0; // returns number of attached HLTV proxies
  24. virtual int GetNumFakeClients() const = 0; // returns number of fake clients/bots
  25. virtual int GetMaxClients( void ) const = 0; // returns current client limit
  26. virtual IClient *GetClient( int index ) = 0; // returns interface to client
  27. virtual int GetClientCount() const = 0; // returns number of clients slots (used & unused)
  28. virtual int GetUDPPort( void ) const = 0; // returns current used UDP port
  29. virtual float GetTime( void ) const = 0; // returns game world time
  30. virtual int GetTick( void ) const = 0; // returns game world tick
  31. virtual float GetTickInterval( void ) const = 0; // tick interval in seconds
  32. virtual const char *GetName( void ) const = 0; // public server name
  33. virtual const char *GetMapName( void ) const = 0; // current map name (BSP)
  34. virtual int GetSpawnCount( void ) const = 0;
  35. virtual int GetNumClasses( void ) const = 0;
  36. virtual int GetClassBits( void ) const = 0;
  37. virtual void GetNetStats( float &avgIn, float &avgOut ) = 0; // total net in/out in bytes/sec
  38. virtual int GetNumPlayers() = 0;
  39. virtual bool GetPlayerInfo( int nClientIndex, player_info_t *pinfo ) = 0;
  40. virtual bool IsActive( void ) const = 0;
  41. virtual bool IsLoading( void ) const = 0;
  42. virtual bool IsDedicated( void ) const = 0;
  43. virtual bool IsPaused( void ) const = 0;
  44. virtual bool IsMultiplayer( void ) const = 0;
  45. virtual bool IsPausable() const = 0;
  46. virtual bool IsHLTV() const = 0;
  47. virtual bool IsReplay() const = 0;
  48. virtual const char * GetPassword() const = 0; // returns the password or NULL if none set
  49. virtual void SetPaused(bool paused) = 0;
  50. virtual void SetPassword(const char *password) = 0; // set password (NULL to disable)
  51. virtual void BroadcastMessage( INetMessage &msg, bool onlyActive = false, bool reliable = false) = 0;
  52. virtual void BroadcastMessage( INetMessage &msg, IRecipientFilter &filter ) = 0;
  53. virtual void DisconnectClient( IClient *client, const char *reason ) = 0;
  54. };
  55. #endif // ISERVER_H