DlgMPConnectionRefused.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. * NAME
  21. * $Archive: /Commando/Code/Commando/DlgMPConnectionRefused.cpp $
  22. *
  23. * DESCRIPTION
  24. *
  25. ******************************************************************************/
  26. #include "DlgMPConnectionRefused.h"
  27. #include "cnetwork.h"
  28. #include "resource.h"
  29. #include <wwdebug\wwdebug.h>
  30. #include "dlgmainmenu.h"
  31. #include "gamespyadmin.h"
  32. #include "specialbuilds.h"
  33. #include "dialogtests.h"
  34. #include "dialogmgr.h"
  35. #include "gameinitmgr.h"
  36. /******************************************************************************
  37. *
  38. * NAME
  39. * DlgMPConnectionRefused::DoDialog
  40. *
  41. * DESCRIPTION
  42. *
  43. * INPUTS
  44. * NONE
  45. *
  46. * RESULT
  47. * True if dialog created successfully.
  48. *
  49. ******************************************************************************/
  50. bool DlgMPConnectionRefused::DoDialog(const WCHAR * text, bool show_splash_screen)
  51. {
  52. DlgMPConnectionRefused* popup = new DlgMPConnectionRefused(text, show_splash_screen);
  53. if (popup)
  54. {
  55. popup->Start_Dialog();
  56. popup->Release_Ref();
  57. }
  58. return (popup != NULL);
  59. }
  60. /******************************************************************************
  61. *
  62. * NAME
  63. * DlgMPConnectionRefused::DlgMPConnectionRefused
  64. *
  65. * DESCRIPTION
  66. * Constructor
  67. *
  68. * INPUTS
  69. * NONE
  70. *
  71. * RESULT
  72. * NONE
  73. *
  74. ******************************************************************************/
  75. DlgMPConnectionRefused::DlgMPConnectionRefused(const WCHAR * text, bool show_splash_screen) :
  76. PopupDialogClass(IDD_MULTIPLAY_CONNECTION_REFUSED)
  77. {
  78. WWDEBUG_SAY(("DlgMPConnectionRefused: Instantiated\n"));
  79. WWASSERT(text != NULL);
  80. Text.Format(text);
  81. ShowSplashScreen = show_splash_screen;
  82. }
  83. /******************************************************************************
  84. *
  85. * NAME
  86. * DlgMPConnectionRefused::~DlgMPConnectionRefused
  87. *
  88. * DESCRIPTION
  89. * Destructor
  90. *
  91. * INPUTS
  92. * NONE
  93. *
  94. * RESULT
  95. * NONE
  96. *
  97. ******************************************************************************/
  98. DlgMPConnectionRefused::~DlgMPConnectionRefused()
  99. {
  100. WWDEBUG_SAY(("DlgMPConnectionRefused: Destructing\n"));
  101. }
  102. /******************************************************************************
  103. *
  104. * NAME
  105. * DlgMPConnectionRefused::On_Init_Dialog
  106. *
  107. * DESCRIPTION
  108. *
  109. * INPUTS
  110. * NONE
  111. *
  112. * RESULT
  113. * NONE
  114. *
  115. ******************************************************************************/
  116. void DlgMPConnectionRefused::On_Init_Dialog(void)
  117. {
  118. Set_Dlg_Item_Text(IDC_REFUSAL_TEXT, Text);
  119. PopupDialogClass::On_Init_Dialog();
  120. }
  121. /******************************************************************************
  122. *
  123. * NAME
  124. * DlgMPConnectionRefused::On_Command
  125. *
  126. * DESCRIPTION
  127. * Process command messages from controls
  128. *
  129. * INPUTS
  130. * Ctrl - ID of control
  131. * Message -
  132. * Param - 0 = User invoked abort. 1 = Connection refused by server.
  133. *
  134. * RESULT
  135. * NONE
  136. *
  137. ******************************************************************************/
  138. void DlgMPConnectionRefused::On_Command(int ctrlID, int message, DWORD param)
  139. {
  140. if ((IDOK == ctrlID) && (1 != param))
  141. {
  142. if (cNetwork::I_Am_Client())
  143. {
  144. cNetwork::Cleanup_Client();
  145. }
  146. if (cGameSpyAdmin::Get_Is_Launched_From_Gamespy())
  147. {
  148. #ifdef MULTIPLAYERDEMO
  149. GameInitMgrClass::End_Game ();
  150. if (ShowSplashScreen)
  151. {
  152. DialogMgrClass::Flush_Dialogs ();
  153. START_DIALOG (SplashOutroMenuDialogClass);
  154. }
  155. else
  156. {
  157. extern void Stop_Main_Loop (int);
  158. Stop_Main_Loop(EXIT_SUCCESS);
  159. }
  160. #else
  161. extern void Stop_Main_Loop (int);
  162. Stop_Main_Loop(EXIT_SUCCESS);
  163. #endif // MULTIPLAYERDEMO
  164. }
  165. else if (DialogMgrClass::Get_Dialog_Count () == 1)
  166. {
  167. START_DIALOG (MainMenuDialogClass);
  168. }
  169. }
  170. PopupDialogClass::On_Command(ctrlID, message, param);
  171. }