NetCommandWrapperList.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. ** Command & Conquer Generals(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. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. ////// NetCommandWrapperList.h ////////////////////////////////
  24. // Bryan Cleveland
  25. #pragma once
  26. #ifndef __NETCOMMANDWRAPPERLIST_H
  27. #define __NETCOMMANDWRAPPERLIST_H
  28. #include "GameNetwork/NetCommandList.h"
  29. class NetCommandWrapperListNode : public MemoryPoolObject
  30. {
  31. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NetCommandWrapperListNode, "NetCommandWrapperListNode")
  32. public:
  33. NetCommandWrapperListNode(NetWrapperCommandMsg *msg);
  34. //virtual ~NetCommandWrapperListNode();
  35. Bool isComplete();
  36. UnsignedShort getCommandID();
  37. UnsignedInt getRawDataLength();
  38. void copyChunkData(NetWrapperCommandMsg *msg);
  39. UnsignedByte * getRawData();
  40. Int getPercentComplete(void);
  41. NetCommandWrapperListNode *m_next;
  42. protected:
  43. UnsignedShort m_commandID;
  44. UnsignedByte *m_data;
  45. UnsignedInt m_dataLength;
  46. Bool *m_chunksPresent;
  47. UnsignedInt m_numChunks;
  48. UnsignedInt m_numChunksPresent;
  49. };
  50. class NetCommandWrapperList : public MemoryPoolObject
  51. {
  52. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NetCommandWrapperList, "NetCommandWrapperList")
  53. public:
  54. NetCommandWrapperList();
  55. //virtual ~NetCommandWrapperList();
  56. void init();
  57. void reset();
  58. void processWrapper(NetCommandRef *ref);
  59. NetCommandList * getReadyCommands();
  60. Int getPercentComplete(UnsignedShort wrappedCommandID);
  61. protected:
  62. void removeFromList(NetCommandWrapperListNode *node);
  63. NetCommandWrapperListNode *m_list;
  64. };
  65. #endif