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.

91 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef IGAMELIST_H
  8. #define IGAMELIST_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. class gameserveritem_t;
  13. #if defined( STEAM )
  14. #include "steam2common.h"
  15. #include "FindSteam2Servers.h"
  16. #else
  17. #include "steamcommon.h"
  18. #include "FindSteamServers.h"
  19. #endif
  20. #include "netadr.h"
  21. typedef enum
  22. {
  23. SERVERVERSION_SAME_VERSION = 0,
  24. SERVERVERSION_SERVER_OLD,
  25. SERVERVERSION_SERVER_NEWER
  26. } SERVERVERSION;
  27. struct serverdisplay_t
  28. {
  29. serverdisplay_t()
  30. {
  31. m_iListID = -1;
  32. m_iServerID = -1;
  33. m_bDoNotRefresh = true;
  34. }
  35. int m_iListID; // the VGUI2 list panel index for displaying this server
  36. int m_iServerID; // the matchmaking interface index for this server
  37. bool m_bDoNotRefresh;
  38. bool operator==( const serverdisplay_t &rhs ) const { return rhs.m_iServerID == m_iServerID; }
  39. };
  40. //-----------------------------------------------------------------------------
  41. // Purpose: Interface to accessing a game list
  42. //-----------------------------------------------------------------------------
  43. class IGameList
  44. {
  45. public:
  46. enum InterfaceItem_e
  47. {
  48. FILTERS,
  49. GETNEWLIST,
  50. ADDSERVER,
  51. ADDCURRENTSERVER,
  52. };
  53. // returns true if the game list supports the specified ui elements
  54. virtual bool SupportsItem(InterfaceItem_e item) = 0;
  55. // starts the servers refreshing
  56. virtual void StartRefresh() = 0;
  57. // gets a new server list
  58. virtual void GetNewServerList() = 0;
  59. // stops current refresh/GetNewServerList()
  60. virtual void StopRefresh() = 0;
  61. // returns true if the list is currently refreshing servers
  62. virtual bool IsRefreshing() = 0;
  63. // gets information about specified server
  64. virtual gameserveritem_t *GetServer(unsigned int serverID) = 0;
  65. // called when Connect button is pressed
  66. virtual void OnBeginConnect() = 0;
  67. // invalid server index
  68. virtual int GetInvalidServerListID() = 0;
  69. // Get code to use for tracking how people are connecting to servers
  70. virtual const char *GetConnectCode() = 0;
  71. };
  72. #endif // IGAMELIST_H