lanchat.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // Filename: lanchat.h
  20. // Project: Network.lib, for Commando
  21. // Author: Tom Spencer-Smith
  22. // Date: Dec 1998
  23. // Description: lan chat interface
  24. //
  25. //-----------------------------------------------------------------------------
  26. #if defined(_MSV_VER)
  27. #pragma once
  28. #endif
  29. #ifndef LANCHAT_H
  30. #define LANCHAT_H
  31. #include "win.h"
  32. #include <winsock.h>
  33. #include "chatshre.h"
  34. class cPacket;
  35. enum LanMessages {
  36. LAN_MESSAGE_POSITION,
  37. };
  38. //-----------------------------------------------------------------------------
  39. class cLanChat
  40. {
  41. public:
  42. cLanChat(void);
  43. ~cLanChat(void);
  44. void Think(void);
  45. void Lan_Packet_Handler(cPacket & packet);
  46. void Go_To_Location(ChatLocationEnum location);
  47. void Accept_Actions(void);
  48. void Refusal_Actions(void);
  49. void Load_Lan_Registry_Keys(void);
  50. void Save_Lan_Registry_Keys(void);
  51. ChatLocationEnum Get_Current_Location(void) {return CurrentLocation;}
  52. void Init_Lan_Protocol_And_Socket(void);
  53. private:
  54. cLanChat(const cLanChat& rhs); // Disallow copy (compile/link time)
  55. cLanChat& operator=(const cLanChat& rhs); // Disallow assignment (compile/link time)
  56. void Send_Position_Broadcast(void);
  57. void Process_Position_Broadcast(cPacket & packet);
  58. SOCKET Socket;
  59. SOCKADDR_IN LocalAddress;
  60. DWORD LastPositionBroadcastTimeMs;
  61. int PositionBroadcastNumber;
  62. ChatLocationEnum CurrentLocation;
  63. static const USHORT LAN_BROADCAST_INTERVAL_MS;
  64. static const USHORT LAN_PORT;
  65. };
  66. #endif // LANCHAT_H