wolgmode.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/wolgmode.h $*
  25. * *
  26. * $Author:: Steve_t $*
  27. * *
  28. * $Modtime:: 10/13/02 10:05p $*
  29. * *
  30. * $Revision:: 36 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSV_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __WOLGMODE_H__
  39. #define __WOLGMODE_H__
  40. #include "GameMode.h"
  41. #include "WOLBuddyMgr.h"
  42. #include <WWOnline\RefPtr.h>
  43. #include <WWLib\Notify.h>
  44. #include <WWLib\Signaler.h>
  45. class cGameData;
  46. class cPlayer;
  47. class WOLChatMgr;
  48. class WOLQuickMatch;
  49. class DlgWOLWaitEvent;
  50. namespace WWOnline
  51. {
  52. class Session;
  53. class ChannelData;
  54. class UserData;
  55. class GameStartEvent;
  56. class GameOptionsMessage;
  57. class ChannelEvent;
  58. class UserEvent;
  59. class LadderInfoEvent;
  60. enum ConnectionStatus;
  61. class ServerError;
  62. }
  63. // Game Mode to do WWOnline (Internet) games
  64. class WolGameModeClass :
  65. public GameModeClass,
  66. public Signaler<WolGameModeClass>,
  67. public Observer<DlgWOLWaitEvent>,
  68. public Observer<WWOnline::GameStartEvent>,
  69. public Observer<WWOnline::GameOptionsMessage>,
  70. public Observer<WWOnline::ChannelEvent>,
  71. public Observer<WWOnline::UserEvent>,
  72. public Observer<WWOnline::LadderInfoEvent>,
  73. public Observer<WOLPagedEvent>,
  74. public Observer<WWOnline::ConnectionStatus>,
  75. public Observer<WWOnline::ServerError>
  76. {
  77. public:
  78. WolGameModeClass();
  79. ~WolGameModeClass();
  80. inline const char* Name(void)
  81. {return "WOL";}
  82. void Init(void);
  83. void Shutdown(void);
  84. void Think(void);
  85. void Render(void) {}
  86. void Create_Game(cGameData*);
  87. void Leave_Game(void);
  88. void Start_Game(cGameData*);
  89. void End_Game(void);
  90. void Accept_Actions(void);
  91. void Refusal_Actions(void);
  92. void Init_WOL_Player(cPlayer* player);
  93. RefPtr<WWOnline::UserData> Get_WOL_User_Data(const wchar_t* name);
  94. void Page_WOL_User(const wchar_t* name, const wchar_t* msg);
  95. void Reply_Last_Page(const wchar_t* msg);
  96. void Locate_WOL_User(const wchar_t* name);
  97. void Invite_WOL_User(const wchar_t* name, const wchar_t* msg);
  98. void Join_WOL_User(const wchar_t* name);
  99. bool Kick_Player(const wchar_t* name);
  100. void Ban_Player(const wchar_t* name, unsigned long ip);
  101. bool Is_Banned(const char *player_name, unsigned long ip);
  102. void Read_Kick_List(void);
  103. void Auto_Kick(void);
  104. void System_Timer_Reset(void);
  105. inline cGameData* Get_Game(void) const
  106. {return mTheGame;}
  107. inline bool Channel_Create_OK(void)
  108. {return mChannelCreateSuccessFlag;}
  109. void Set_Quiet_Mode(bool quiet)
  110. {mQuietMode = quiet;}
  111. bool Post_Game_Check(void);
  112. static void Game_Start_Timeout_Callback(void);
  113. protected:
  114. void Evaluate_Clans(cGameData* theGame);
  115. void Update_Channel_Settings(cGameData* theGame, const RefPtr<WWOnline::ChannelData>& channel);
  116. void Quit_And_Restart(void);
  117. void Handle_Disconnect(void);
  118. void Game_Start_Timed_Out(void);
  119. void HandleNotification(DlgWOLWaitEvent&);
  120. void HandleNotification(WWOnline::GameStartEvent&);
  121. void HandleNotification(WWOnline::GameOptionsMessage&);
  122. void HandleNotification(WWOnline::ChannelEvent&);
  123. void HandleNotification(WWOnline::UserEvent&);
  124. void HandleNotification(WWOnline::LadderInfoEvent&);
  125. void HandleNotification(WOLPagedEvent&);
  126. void HandleNotification(WWOnline::ServerError&);
  127. void HandleNotification(WWOnline::ConnectionStatus&);
  128. private:
  129. RefPtr<WWOnline::Session> mWOLSession;
  130. WOLChatMgr* mWOLChatMgr;
  131. WOLBuddyMgr* mWOLBuddyMgr;
  132. WOLQuickMatch* mQuickMatch;
  133. cGameData* mTheGame;
  134. unsigned long mGameID;
  135. bool mGameInProgress;
  136. unsigned long mSendServerInfoTime;
  137. bool mQuietMode;
  138. bool mConnected;
  139. unsigned long mLastPatchCheckTime;
  140. unsigned long mStartQuitProcessTime;
  141. bool mPatchAvailable;
  142. bool mMonitorConnection;
  143. // This flag is set to true when we successfully create a game channel.
  144. // Used in conjunction with signalling to indicate completion status.
  145. bool mChannelCreateSuccessFlag;
  146. DynamicVectorClass<StringClass> KickNameList;
  147. DynamicVectorClass<unsigned long> KickIPList;
  148. DynamicVectorClass<StringClass> IdleKickNameList;
  149. DynamicVectorClass<unsigned int> IdleKickTimeList;
  150. };
  151. #endif // __WOLGMODE_H__