Counter Strike : Global Offensive Source Code
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.

126 lines
3.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CREATEMULTIPLAYERGAMESERVERPAGE_H
  8. #define CREATEMULTIPLAYERGAMESERVERPAGE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Frame.h>
  13. #include <vgui_controls/Button.h>
  14. #include <vgui_controls/ComboBox.h>
  15. //-----------------------------------------------------------------------------
  16. // Purpose: Data describing a single server
  17. //-----------------------------------------------------------------------------
  18. struct serveritem_t
  19. {
  20. serveritem_t()
  21. {
  22. pings[0] = 0;
  23. pings[1] = 0;
  24. pings[2] = 0;
  25. }
  26. unsigned char ip[4];
  27. int port;
  28. int received;
  29. float time;
  30. int ping; // current ping time, derived from pings[]
  31. int pings[3]; // last 3 ping times
  32. bool hadSuccessfulResponse; // server has responded successfully in the past
  33. bool doNotRefresh; // server is marked as not responding and should no longer be refreshed
  34. char gameDir[32]; // current game directory
  35. char map[32]; // current map
  36. char gameDescription[64]; // game description
  37. char name[64]; // server name
  38. int players;
  39. int maxPlayers;
  40. int botPlayers;
  41. bool proxy;
  42. bool password;
  43. bool secure;
  44. bool loadedFromFile; // true if this entry was loaded from file rather than comming from the master
  45. unsigned int serverID;
  46. int listEntryID;
  47. char rconPassword[64]; // the rcon password for this server
  48. };
  49. //-----------------------------------------------------------------------------
  50. // Purpose: server options page of the create game server dialog
  51. //-----------------------------------------------------------------------------
  52. class CCreateMultiplayerGameServerPage : public vgui::Frame
  53. {
  54. DECLARE_CLASS_SIMPLE( CCreateMultiplayerGameServerPage, vgui::Frame );
  55. public:
  56. CCreateMultiplayerGameServerPage(vgui::Panel *parent, const char *name);
  57. ~CCreateMultiplayerGameServerPage();
  58. // returns currently entered information about the server
  59. int GetMaxPlayers() { return m_iMaxPlayers; }
  60. const char *GetPassword() { return m_szPassword; }
  61. const char *GetHostName() { return m_szHostName; }
  62. const char *GetMapName();
  63. const char *GetModName() { return m_szMod; }
  64. const char *GetGameName() { return m_szGameName; }
  65. void LoadMapList();
  66. int LoadMaps( const char *pszMod );
  67. virtual void OnCommand(const char *cmd);
  68. virtual void OnResetData();
  69. void GetServer(serveritem_t &s);
  70. const char *GetRconPassword();
  71. private:
  72. enum { MAX_PLAYERS = 32 };
  73. enum { DATA_STR_LENGTH = 64 };
  74. void LoadConfig();
  75. void SaveConfig();
  76. void SetConfig(const char *serverName, const char *rconPassword, int maxPlayers, const char *map, const char *mod, int network, int secure, int port);
  77. bool LaunchOldDedicatedServer( KeyValues *pGameInfo );
  78. //void OnCommand(const char *text);
  79. void LoadMODList();
  80. void LoadModListInDirectory( const char *pDirectoryName );
  81. void LoadPossibleMod( const char *pGameDirName );
  82. void AddMod( const char *pGameDirName, const char *pGameInfoFilename, KeyValues *pGameInfo );
  83. bool BadRconChars(const char *pass);
  84. vgui::ComboBox *m_pGameCombo;
  85. vgui::ComboBox *m_pMapList;
  86. vgui::ComboBox *m_pNumPlayers;
  87. vgui::ComboBox *m_pNetworkCombo;
  88. vgui::Button *m_pStartServerButton;
  89. vgui::Button *m_pCancelButton;
  90. vgui::CheckButton *m_pSecureCheck;
  91. MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
  92. serveritem_t m_iServer;
  93. char m_szHostName[DATA_STR_LENGTH];
  94. char m_szPassword[DATA_STR_LENGTH];
  95. char m_szMapName[DATA_STR_LENGTH];
  96. char m_szMod[DATA_STR_LENGTH];
  97. char m_szGameName[DATA_STR_LENGTH];
  98. char m_szExtra[DATA_STR_LENGTH*2];
  99. int m_iMaxPlayers;
  100. int m_iPort;
  101. vgui::Panel *m_MainPanel;
  102. KeyValues *m_pSavedData; // data to save away
  103. KeyValues *m_pGameInfo;
  104. };
  105. #endif // CREATEMULTIPLAYERGAMESERVERPAGE_H