NetDlg.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. // NetDlg.H
  19. // Project: Nostril (aka Postal)
  20. //
  21. // History:
  22. // 04/08/97 JMI Started.
  23. //
  24. // 05/25/97 JMI Integrated newest TCP/IP CNetServer/Client interface.
  25. // Still need to detect when the game is starting.
  26. // GUI could still use a little cleaning up.
  27. //
  28. // 05/26/97 JMI Removed psNumPlayers and psMyPlayerNum parameters.
  29. //
  30. // 06/13/97 MJR Changed function prototypes.
  31. //
  32. // 06/16/97 MJR Added use of watchdog timer for network blocking callbacks.
  33. //
  34. // 08/02/97 JMI Added an icon to watchdog timer for network blocking
  35. // callbacks and made it generally callable.
  36. //
  37. // 08/10/97 MJR Added browse parameter to DoNetGameDialog().
  38. //
  39. // 08/27/97 JMI Changed NetProbIcons functions to NetProbGui functions.
  40. // Also, instead of a DrawNetProbGui() there's a
  41. // GetNetProbGui() so you can draw it, move it, change the
  42. // text, etc.
  43. //
  44. ////////////////////////////////////////////////////////////////////////////////
  45. #ifndef NETDLG_H
  46. #define NETDLG_H
  47. #include "RSPiX.h"
  48. #include "netclient.h"
  49. #include "netserver.h"
  50. // More than one module needs to know the "standard" abort key for the "NetProb"
  51. // gui that this module defines. This gives both types of rspix codes for the
  52. // key along with the descriptive text for that key.
  53. #define NET_PROB_GUI_ABORT_GK_KEY RSP_GK_F9
  54. #define NET_PROB_GUI_ABORT_SK_KEY RSP_SK_F9
  55. #define NET_PROB_GUI_ABORT_KEY_TEXT "F9"
  56. // This is a general message for the "NetProb" gui that works for general
  57. // cases of "network not responding".
  58. extern char* g_pszNetProb_General;
  59. ////////////////////////////////////////////////////////////////////////////////
  60. //
  61. // Do network game dialog
  62. //
  63. ////////////////////////////////////////////////////////////////////////////////
  64. extern short DoNetGameDialog( // Returns 0 if successfull, non-zero otherwise.
  65. CNetClient* pclient, // I/O: Client interface
  66. bool bBrowse, // In: Whether to browse (true) or connect (false)
  67. CNetServer* pserver, // I/O: Server interface or NULL if not server
  68. NetMsg* pmsgOut); // Out: NetMsg::NOTHING or NetMsg::START_GAME
  69. //////////////////////////////////////////////////////////////////////////////
  70. //
  71. // Get text associated with the specified error message
  72. //
  73. //////////////////////////////////////////////////////////////////////////////
  74. extern const char* NetErrorText( // Returns pointer to text
  75. NetMsg* pmsg); // In: Error message
  76. //////////////////////////////////////////////////////////////////////////////
  77. //
  78. // Check if a blocked network operation was aborted.
  79. //
  80. //////////////////////////////////////////////////////////////////////////////
  81. extern bool NetBlockingWasAborted(void);
  82. ////////////////////////////////////////////////////////////////////////////////
  83. //
  84. // Net blocking watchdog. Call this periodically to let the watchdog know
  85. // that the program hasn't locked up.
  86. //
  87. ////////////////////////////////////////////////////////////////////////////////
  88. extern void NetBlockingWatchdog(void);
  89. //////////////////////////////////////////////////////////////////////////////
  90. //
  91. // Initialize the net problems GUI.
  92. // Note that this is nearly instantaneous (no file access) if it has already
  93. // been called. That is, calling this twice in a row is fine. Just make
  94. // sure you call KillNetProbGUI() when done (although, even that is not
  95. // essential).
  96. //
  97. //////////////////////////////////////////////////////////////////////////////
  98. extern short InitNetProbGUI(void);
  99. //////////////////////////////////////////////////////////////////////////////
  100. //
  101. // Kill the net problems GUI.
  102. //
  103. //////////////////////////////////////////////////////////////////////////////
  104. extern void KillNetProbGUI(void);
  105. //////////////////////////////////////////////////////////////////////////////
  106. //
  107. // Get the net prob GUI which is used to notify the user of network problems.
  108. // You can move it, draw it, change its text, or whatever. It's just up to
  109. // you to avoid having a problem with other things updating its settings while
  110. // you are.
  111. // Note that this is automagically drawn to the screen via the blocking
  112. // callback.
  113. //
  114. //////////////////////////////////////////////////////////////////////////////
  115. extern RTxt* GetNetProbGUI(void); // Returns the net prob GUI.
  116. //////////////////////////////////////////////////////////////////////////////
  117. //
  118. // Determine whether there is a net problem. Set via blocking callback.
  119. // Cleared by you when you call ClearNetProb().
  120. //
  121. //////////////////////////////////////////////////////////////////////////////
  122. extern bool IsNetProb(void); // Returns true, if net problem; false otherwise.
  123. //////////////////////////////////////////////////////////////////////////////
  124. //
  125. // Clear a net problem. After a call to this function, IsNetProb() will
  126. // return false until the next net blocking callback or other asynch net
  127. // error.
  128. //
  129. //////////////////////////////////////////////////////////////////////////////
  130. extern void ClearNetProb(void); // Returns nothing.
  131. #endif // NETDLG_H
  132. ////////////////////////////////////////////////////////////////////////////////
  133. // EOF
  134. ////////////////////////////////////////////////////////////////////////////////