WOLJoinGame.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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/WOLJoinGame.h $
  22. *
  23. * DESCRIPTION
  24. *
  25. * PROGRAMMER
  26. * $Author: Denzil_l $
  27. *
  28. * VERSION INFO
  29. * $Revision: 10 $
  30. * $Modtime: 1/16/02 4:25p $
  31. *
  32. ******************************************************************************/
  33. #ifndef __WOLJOINGAME_H__
  34. #define __WOLJOINGAME_H__
  35. #include <WWLib\RefCount.h>
  36. #include <WWLib\Notify.h>
  37. #include <WWLib\Signaler.h>
  38. #include <WWLib\WideString.h>
  39. #include <WWOnline\RefPtr.h>
  40. #include "DlgMPTeamSelect.h"
  41. namespace WWOnline
  42. {
  43. class Session;
  44. class ChannelData;
  45. class ChannelEvent;
  46. }
  47. class cGameData;
  48. class DlgWOLWaitEvent;
  49. class WOLJoinGame :
  50. public RefCountClass,
  51. public Observer<WWOnline::ChannelEvent>,
  52. public Observer<DlgWOLWaitEvent>,
  53. public Signaler<MPChooseTeamSignal>
  54. {
  55. public:
  56. static void JoinTheGame(const wchar_t* gameName, const wchar_t* password, bool allowTeamSelect);
  57. protected:
  58. WOLJoinGame();
  59. ~WOLJoinGame();
  60. // Prevent copy and assignment
  61. WOLJoinGame(const WOLJoinGame&);
  62. const WOLJoinGame& operator=(const WOLJoinGame&);
  63. bool FinalizeCreate(void);
  64. cGameData* CreateGameFromChannel(const RefPtr<WWOnline::ChannelData>& channel);
  65. bool Join(const wchar_t* gameName, const wchar_t* password, bool allowTeamSelect);
  66. void ProceedWithConnection(int teamChoice);
  67. void Leave(void);
  68. bool StartServerConnect(void);
  69. void ConnectToServer(void);
  70. void HandleNotification(WWOnline::ChannelEvent&);
  71. void HandleNotification(DlgWOLWaitEvent&);
  72. void ReceiveSignal(MPChooseTeamSignal&);
  73. private:
  74. RefPtr<WWOnline::Session> mWOLSession;
  75. typedef enum {IDLE_STATE = 0, JOINING_STATE, FIREWALL_STATE} JoinState;
  76. JoinState mJoinState;
  77. bool mAllowTeamSelect;
  78. WideStringClass mGameName;
  79. WideStringClass mPassword;
  80. RefPtr<WWOnline::ChannelData> mTheChannel;
  81. int mTeamChoice;
  82. unsigned long mClanID;
  83. };
  84. #endif __WOLJOINGAME_H__