definitionclassids.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WWSaveLoad *
  23. * *
  24. * $Archive:: /Commando/Code/wwsaveload/definitionclassids.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 8/03/00 5:44p $*
  29. * *
  30. * $Revision:: 15 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __DEFINITION_CLASS_ID_H
  39. #define __DEFINITION_CLASS_ID_H
  40. #include "always.h"
  41. #include "bittype.h"
  42. //////////////////////////////////////////////////////////////////////////////////
  43. //
  44. // Constants
  45. //
  46. //////////////////////////////////////////////////////////////////////////////////
  47. const int DEF_CLASSID_START = 0x00001000;
  48. const int DEF_CLASSID_RANGE = 0x00001000;
  49. #define NEXT_SUPER_CLASSID(n) DEF_CLASSID_START + (n * DEF_CLASSID_RANGE)
  50. //////////////////////////////////////////////////////////////////////////////////
  51. //
  52. // DefinitionClassID
  53. //
  54. // Note: The following enum should contain ALL of the class ids for
  55. // definitions in the entire system (to guarantee they are unique). Each
  56. // super-class is allocated a range of class ids. Use the
  57. // SuperClassID_From_ClassID function to determine which super class
  58. // a particular class id belongs to.
  59. //
  60. //////////////////////////////////////////////////////////////////////////////////
  61. enum
  62. {
  63. CLASSID_TERRAIN = NEXT_SUPER_CLASSID(0),
  64. CLASSID_TILE = NEXT_SUPER_CLASSID(1),
  65. CLASSID_GAME_OBJECTS = NEXT_SUPER_CLASSID(2),
  66. CLASSID_LIGHT = NEXT_SUPER_CLASSID(3),
  67. CLASSID_SOUND = NEXT_SUPER_CLASSID(4),
  68. CLASSID_WAYPATH = NEXT_SUPER_CLASSID(5),
  69. CLASSID_ZONE = NEXT_SUPER_CLASSID(6),
  70. CLASSID_TRANSITION = NEXT_SUPER_CLASSID(7),
  71. CLASSID_PHYSICS = NEXT_SUPER_CLASSID(8),
  72. CLASSID_EDITOR_OBJECTS = NEXT_SUPER_CLASSID(9),
  73. CLASSID_MUNITIONS = NEXT_SUPER_CLASSID(10),
  74. CLASSID_DUMMY_OBJECTS = NEXT_SUPER_CLASSID(11),
  75. CLASSID_BUILDINGS = NEXT_SUPER_CLASSID(12),
  76. CLASSID_TWIDDLERS = NEXT_SUPER_CLASSID(13),
  77. CLASSID_GLOBAL_SETTINGS = NEXT_SUPER_CLASSID(14),
  78. };
  79. //////////////////////////////////////////////////////////////////////////////////
  80. //
  81. // SuperClassID_From_ClassID
  82. //
  83. //////////////////////////////////////////////////////////////////////////////////
  84. inline uint32
  85. SuperClassID_From_ClassID (uint32 class_id)
  86. {
  87. //
  88. // Which id-range does it fall under?
  89. //
  90. int delta = class_id - DEF_CLASSID_START;
  91. int num_ranges = delta / DEF_CLASSID_RANGE;
  92. return DEF_CLASSID_START + (num_ranges * DEF_CLASSID_RANGE);
  93. }
  94. #endif //__DEFINITION_CLASS_ID_H