WOLGame.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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/WOLGame.h $
  22. *
  23. * DESCRIPTION
  24. *
  25. * PROGRAMMER
  26. * $Author: Steve_t $
  27. *
  28. * VERSION INFO
  29. * $Revision: 6 $
  30. * $Modtime: 8/21/02 12:31p $
  31. *
  32. ******************************************************************************/
  33. #ifndef __WOLGAME_H__
  34. #define __WOLGAME_H__
  35. #include "RefPtr.h"
  36. #include "WOLUser.h"
  37. #include "WaitCondition.h"
  38. #include <WWLib\Notify.h>
  39. namespace WWOnline {
  40. class ChannelData;
  41. class GameStartEvent
  42. {
  43. public:
  44. const RefPtr<ChannelData>& GetChannel(void) const
  45. {return mChannel;}
  46. const UserList& GetPlayers(void) const
  47. {return mPlayers;}
  48. const unsigned long GetGameID(void) const
  49. {return mGameID;}
  50. bool IsSuccess(void) const
  51. {return SUCCEEDED(mResult);}
  52. const char* GetErrorDescription(void) const;
  53. GameStartEvent(HRESULT result) :
  54. mResult(result),
  55. mGameID(0)
  56. {}
  57. GameStartEvent(const RefPtr<ChannelData>& channel, const UserList& users, unsigned long gameID);
  58. ~GameStartEvent()
  59. {}
  60. protected:
  61. GameStartEvent(const GameStartEvent&);
  62. const GameStartEvent operator=(const GameStartEvent&);
  63. private:
  64. HRESULT mResult;
  65. RefPtr<ChannelData> mChannel;
  66. UserList mPlayers;
  67. unsigned long mGameID;
  68. };
  69. class GameStartWait :
  70. public SingleWait,
  71. public Observer<GameStartEvent>
  72. {
  73. public:
  74. static RefPtr<GameStartWait> Create(const UserList& players, void(*callback)(void) = NULL);
  75. void WaitBeginning(void);
  76. protected:
  77. GameStartWait(const UserList& players, void(*callback)(void) = NULL);
  78. virtual ~GameStartWait();
  79. // Prevent copy and assignment
  80. GameStartWait(const GameStartWait&);
  81. const GameStartWait& operator=(const GameStartWait&);
  82. void HandleNotification(GameStartEvent&);
  83. void EndWait(WaitResult result, const wchar_t* endText);
  84. void (*mTimeoutCallback)(void);
  85. NativeWOLUserList mPlayers;
  86. };
  87. }
  88. #endif // __WOLGAME_H__