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.

61 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include <stdio.h>
  8. #include "ServerConfigPanel.h"
  9. #include <vgui/ISystem.h>
  10. using namespace vgui;
  11. //-----------------------------------------------------------------------------
  12. // Purpose: Constructor
  13. //-----------------------------------------------------------------------------
  14. CServerConfigPanel::CServerConfigPanel(vgui::Panel *parent, const char *name, const char *mod) : CVarListPropertyPage(parent, name)
  15. {
  16. SetBounds(0, 0, 500, 170);
  17. LoadControlSettings("Admin\\ServerConfigPanel.res", "PLATFORM");
  18. // load our rules
  19. if (!LoadVarList("scripts/GameServerConfig.vdf"))
  20. {
  21. //!! no local mod info, need to load from server
  22. //!! always load from server if on a remote connection
  23. }
  24. m_flUpdateTime = 0.0f;
  25. }
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Destructor
  28. //-----------------------------------------------------------------------------
  29. CServerConfigPanel::~CServerConfigPanel()
  30. {
  31. }
  32. //-----------------------------------------------------------------------------
  33. // Purpose: Reset data
  34. //-----------------------------------------------------------------------------
  35. void CServerConfigPanel::OnResetData()
  36. {
  37. RefreshVarList();
  38. // update every minute
  39. m_flUpdateTime = (float)system()->GetFrameTime() + (60 * 1.0f);
  40. }
  41. //-----------------------------------------------------------------------------
  42. // Purpose: Checks to see if data needs to be refreshed
  43. //-----------------------------------------------------------------------------
  44. void CServerConfigPanel::OnThink()
  45. {
  46. if (m_flUpdateTime < system()->GetFrameTime())
  47. {
  48. OnResetData();
  49. }
  50. }