WOLLoginProfile.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /******************************************************************************
  19. *
  20. * FILE
  21. * $Archive: /Commando/Code/Commando/WOLLoginProfile.h $
  22. *
  23. * DESCRIPTION
  24. *
  25. * PROGRAMMER
  26. * Denzil E. Long, Jr.
  27. * $Author: Denzil_l $
  28. *
  29. * VERSION INFO
  30. * $Revision: 7 $
  31. * $Modtime: 1/19/02 2:23p $
  32. *
  33. ******************************************************************************/
  34. #ifndef __WOLLOGINPROFILE_H__
  35. #define __WOLLOGINPROFILE_H__
  36. #include <WWLib\RefCount.h>
  37. #include <WWLib\WWString.h>
  38. #include <WWLib\WideString.h>
  39. #include <WWOnline\WOLLadder.h>
  40. class LoginProfile :
  41. public RefCountClass
  42. {
  43. public:
  44. struct Ranking
  45. {
  46. unsigned int Wins;
  47. unsigned int Losses;
  48. unsigned int Deaths;
  49. unsigned int Kills;
  50. unsigned int Points;
  51. unsigned int Rank;
  52. };
  53. static void EnableSaving(bool);
  54. static void SetCurrent(LoginProfile*);
  55. // Get the profile for the specified login.
  56. static LoginProfile* Get(const wchar_t* loginName, bool createOK = false);
  57. // Create a login profile.
  58. static LoginProfile* Create(const wchar_t* loginName);
  59. // Delete the profile.
  60. static void Delete(const wchar_t* loginName);
  61. // Get login name
  62. const wchar_t* GetName(void) const;
  63. // Set the preferred game server
  64. void SetPreferredServer(const char* name);
  65. // Get the preferred game server
  66. const char* GetPreferredServer(void) const
  67. {return (const char*)mServer;}
  68. void SetLocale(WOL::Locale locale);
  69. WOL::Locale GetLocale(void) const
  70. {return mLocale;}
  71. // Set the side preference
  72. void SetSidePreference(int side);
  73. int GetSidePreference(void) const
  74. {return mSidePref;}
  75. void SetGamesPlayed(unsigned long);
  76. unsigned long GetGamesPlayed(void) const
  77. {return mGamesPlayed;}
  78. // Get cached ranking
  79. const Ranking* GetRanking(WWOnline::LadderType type) const;
  80. void SetRanking(WWOnline::LadderType type, Ranking& rank);
  81. // Load profile settings
  82. void LoadSettings(void);
  83. // Save profile settings
  84. void SaveSettings(void);
  85. protected:
  86. LoginProfile();
  87. virtual ~LoginProfile();
  88. bool FinalizeCreate(const wchar_t* loginName);
  89. void LoadRank(const char* valueName, Ranking& rank);
  90. void SaveRank(const char* valueName, const Ranking& rank);
  91. private:
  92. static bool _mSaveAllowed;
  93. static LoginProfile* _mCurrentProfile;
  94. WideStringClass mName;
  95. StringClass mServer;
  96. WOL::Locale mLocale;
  97. int mSidePref;
  98. unsigned long mGamesPlayed;
  99. Ranking mTeamRank;
  100. Ranking mClanRank;
  101. };
  102. class DialogBaseClass;
  103. void ShowProfileRanking(DialogBaseClass* dialog, const LoginProfile* profile);
  104. #endif // __WOLLOGINPROFILE_H__