GameResField.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. * FILE
  21. * $Archive: /Commando/Code/WWOnline/GameResField.h $
  22. *
  23. * DESCRIPTION
  24. *
  25. * PROGRAMMER
  26. * $Author: Denzil_l $
  27. *
  28. * VERSION INFO
  29. * $Revision: 2 $
  30. * $Modtime: 8/15/01 5:49p $
  31. *
  32. ******************************************************************************/
  33. #pragma once
  34. #ifndef __GAMERESFIELD_H__
  35. #define __GAMERESFIELD_H__
  36. namespace WWOnline {
  37. class GameResPacket;
  38. #define GAMERESFIELD_HEADER_SIZE (sizeof(GameResField) - (sizeof(void *) * 2))
  39. class GameResField {
  40. public:
  41. enum Type {
  42. TYPE_CHAR = 1,
  43. TYPE_UNSIGNED_CHAR,
  44. TYPE_SHORT,
  45. TYPE_UNSIGNED_SHORT,
  46. TYPE_LONG,
  47. TYPE_UNSIGNED_LONG,
  48. TYPE_STRING,
  49. TYPE_CHUNK = 20
  50. };
  51. friend class GameResPacket;
  52. // Define constructors to be able to create all the different kinds
  53. // of fields.
  54. GameResField(void) {};
  55. GameResField(char *id, char data);
  56. GameResField(char *id, unsigned char data);
  57. GameResField(char *id, short data);
  58. GameResField(char *id, unsigned short data);
  59. GameResField(char *id, long data);
  60. GameResField(char *id, unsigned long data);
  61. GameResField(char *id, char *data);
  62. GameResField(char *id, void *data, int length);
  63. ~GameResField();
  64. void Host_To_Net(void);
  65. void Net_To_Host(void);
  66. #ifdef _DEBUG
  67. void DebugDump(void);
  68. #endif
  69. private:
  70. char mID[4];
  71. unsigned short mDataType;
  72. unsigned short mSize;
  73. void* mData;
  74. GameResField* mNext;
  75. };
  76. } // namespace WWOnline
  77. #endif __GAMERESFIELD_H__