WOLLadder.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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/WWOnline/WOLLadder.h $
  22. *
  23. * DESCRIPTION
  24. *
  25. * PROGRAMMER
  26. * $Author: Denzil_l $
  27. *
  28. * VERSION INFO
  29. * $Revision: 6 $
  30. * $Modtime: 1/25/02 11:51a $
  31. *
  32. ******************************************************************************/
  33. #ifndef __WOLLADDER_H__
  34. #define __WOLLADDER_H__
  35. #pragma warning(disable : 4711)
  36. #include "RefCounted.h"
  37. #include "RefPtr.h"
  38. namespace WOL
  39. {
  40. #include <wolapi\wolapi.h>
  41. }
  42. namespace WWOnline {
  43. typedef enum
  44. {
  45. LadderType_Individual = (1<<16L),
  46. LadderType_Clan = (1<<23L),
  47. LadderType_Team = (1<<24L)
  48. } LadderType;
  49. #define LADDERTYPE_MASK (LadderType_Individual | LadderType_Clan | LadderType_Team)
  50. class LadderData :
  51. public RefCounted
  52. {
  53. public:
  54. static RefPtr<LadderData> Create(const WOL::Ladder& ladder, long time);
  55. bool UpdateData(const WOL::Ladder& ladder, long time);
  56. const char* GetName(void) const
  57. {return (const char*)mData.login_name;}
  58. unsigned int GetWins(void) const
  59. {return mData.wins;}
  60. unsigned int GetLosses(void) const
  61. {return mData.losses;}
  62. unsigned int GetPoints(void) const
  63. {return mData.points;}
  64. unsigned int GetKills(void) const
  65. {return mData.kills;}
  66. unsigned int GetRung(void) const
  67. {return mData.rung;}
  68. unsigned int GetReserved1(void) const
  69. {return mData.reserved1;}
  70. unsigned int GetReserved2(void) const
  71. {return mData.reserved2;}
  72. long GetTimeStamp(void) const
  73. {return mTimeStamp;}
  74. WOL::Ladder& GetData()
  75. {return mData;}
  76. protected:
  77. LadderData(const WOL::Ladder& ladder, long time);
  78. virtual ~LadderData();
  79. WOL::Ladder mData;
  80. long mTimeStamp;
  81. };
  82. class LadderInfoEvent
  83. {
  84. public:
  85. LadderInfoEvent(const wchar_t* requested, const WOL::Ladder& ladder, long time);
  86. virtual ~LadderInfoEvent()
  87. {}
  88. bool IsRanked(void) const;
  89. LadderType GetLadderType(void) const;
  90. const wchar_t* GetRequestedName(void) const
  91. {return mRequestedName;}
  92. const char* GetReceivedName(void) const
  93. {return (const char*)mWOLLadder.login_name;}
  94. const WOL::Ladder& GetWOLLadder(void) const
  95. {return mWOLLadder;}
  96. long GetTimeStamp(void) const
  97. {return mTimeStamp;}
  98. protected:
  99. // Prevent copy and assignment
  100. LadderInfoEvent(const LadderInfoEvent&);
  101. const LadderInfoEvent& operator=(const LadderInfoEvent&);
  102. const wchar_t* mRequestedName;
  103. const WOL::Ladder& mWOLLadder;
  104. long mTimeStamp;
  105. };
  106. }
  107. #endif // __WOLLADDER_H__