singlepl.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: singlepl.h
  20. // Project: wwnet
  21. // Author: Tom Spencer-Smith
  22. // Date: Nov 1998
  23. // Description: Single player stuff
  24. //
  25. // TODO:
  26. // - merge into netutil ?
  27. //
  28. //
  29. //-----------------------------------------------------------------------------
  30. #if defined(_MSV_VER)
  31. #pragma once
  32. #endif
  33. #ifndef SINGLEPL_H
  34. #define SINGLEPL_H
  35. #include "bittype.h"
  36. #include "slist.h"
  37. enum {
  38. CLIENT_LIST = 0,
  39. SERVER_LIST
  40. };
  41. class cPacket;
  42. //
  43. // This is used in single-player mode and is global, not owned by the
  44. // C or S threads. A critical section is used to control access by
  45. // the C and S threads. The client writes to the end of the Server list and
  46. // reads from the beginning of the Client list. Vice versa for the server.
  47. // Send_Packet handles everything transparently.
  48. // TSS - linked list
  49. //
  50. class cSinglePlayerData
  51. {
  52. public:
  53. static void Init();
  54. static void Cleanup();
  55. static bool Is_Single_Player() {return IsSinglePlayer;}
  56. static SList<cPacket> * Get_Input_Packet_List(int type);
  57. private:
  58. static bool IsSinglePlayer;
  59. static SList<cPacket> InputPacketList[2];
  60. };
  61. //-----------------------------------------------------------------------------
  62. #endif // SINGLEPL_H