CCINI.H 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. ** Command & Conquer Red Alert(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. /* $Header: /CounterStrike/CCINI.H 1 3/03/97 10:24a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** 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 ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : CCINI.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 05/24/96 *
  30. * *
  31. * Last Update : May 24, 1996 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef CCINI_H
  37. #define CCINI_H
  38. #include "ini.h"
  39. #include "fixed.h"
  40. #include "pk.h"
  41. class TriggerTypeClass;
  42. /*
  43. ** The advanced version of the INI database manager. It handles the C&C expansion types and
  44. ** identifiers. In addition, it automatically stores a message digest with the INI data
  45. ** so that verification can occur.
  46. */
  47. class CCINIClass : public INIClass
  48. {
  49. public:
  50. CCINIClass(void) : IsDigestPresent(false) {}
  51. bool Load(FileClass & file, bool withdigest);
  52. bool Load(Straw & file, bool withdigest);
  53. int Save(FileClass & file, bool withdigest) const;
  54. int Save(Pipe & pipe, bool withdigest) const;
  55. long Get_Buildings(char const * section, char const * entry, long defvalue) const;
  56. UnitType Get_UnitType(char const * section, char const * entry, UnitType defvalue) const;
  57. AnimType Get_AnimType(char const * section, char const * entry, AnimType defvalue) const;
  58. ArmorType Get_ArmorType(char const * section, char const * entry, ArmorType defvalue) const;
  59. BulletType Get_BulletType(char const * section, char const * entry, BulletType defvalue) const;
  60. HousesType Get_HousesType(char const * section, char const * entry, HousesType defvalue) const;
  61. LEPTON Get_Lepton(char const * section, char const * entry, LEPTON defvalue) const;
  62. MPHType Get_MPHType(char const * section, char const * entry, MPHType defvalue) const;
  63. OverlayType Get_OverlayType(char const * section, char const * entry, OverlayType defvalue) const;
  64. SourceType Get_SourceType(char const * section, char const * entry, SourceType defvalue) const;
  65. TerrainType Get_TerrainType(char const * section, char const * entry, TerrainType defvalue) const;
  66. TheaterType Get_TheaterType(char const * section, char const * entry, TheaterType defvalue) const;
  67. ThemeType Get_ThemeType(char const * section, char const * entry, ThemeType defvalue) const;
  68. TriggerTypeClass * Get_TriggerType(char const * section, char const * entry) const;
  69. VQType Get_VQType(char const * section, char const * entry, VQType defvalue) const;
  70. VocType Get_VocType(char const * section, char const * entry, VocType defvalue) const;
  71. WarheadType Get_WarheadType(char const * section, char const * entry, WarheadType defvalue) const;
  72. WeaponType Get_WeaponType(char const * section, char const * entry, WeaponType defvalue) const;
  73. long Get_Owners(char const * section, char const * entry, long defvalue) const;
  74. CrateType Get_CrateType(char const * section, char const * entry, CrateType defvalue) const;
  75. bool Put_Buildings(char const * section, char const * entry, long value);
  76. bool Put_AnimType(char const * section, char const * entry, AnimType value);
  77. bool Put_UnitType(char const * section, char const * entry, UnitType value);
  78. bool Put_ArmorType(char const * section, char const * entry, ArmorType value);
  79. bool Put_BulletType(char const * section, char const * entry, BulletType value);
  80. bool Put_HousesType(char const * section, char const * entry, HousesType value);
  81. bool Put_Lepton(char const * section, char const * entry, LEPTON value);
  82. bool Put_MPHType(char const * section, char const * entry, MPHType value);
  83. bool Put_VQType(char const * section, char const * entry, VQType value);
  84. bool Put_OverlayType(char const * section, char const * entry, OverlayType value);
  85. bool Put_Owners(char const * section, char const * entry, long value);
  86. bool Put_SourceType(char const * section, char const * entry, SourceType value);
  87. bool Put_TerrainType(char const * section, char const * entry, TerrainType value);
  88. bool Put_TheaterType(char const * section, char const * entry, TheaterType value);
  89. bool Put_ThemeType(char const * section, char const * entry, ThemeType value);
  90. bool Put_TriggerType(char const * section, char const * entry, TriggerTypeClass * value);
  91. bool Put_VocType(char const * section, char const * entry, VocType value);
  92. bool Put_WarheadType(char const * section, char const * entry, WarheadType value);
  93. bool Put_WeaponType(char const * section, char const * entry, WeaponType value);
  94. bool Put_CrateType(char const * section, char const * entry, CrateType value);
  95. int Get_Unique_ID(void) const;
  96. private:
  97. void Calculate_Message_Digest(void);
  98. void Invalidate_Message_Digest(void);
  99. bool IsDigestPresent:1;
  100. /*
  101. ** This is the message digest (SHA) of the INI database that was embedded as part of
  102. ** the INI file.
  103. */
  104. unsigned char Digest[20];
  105. };
  106. #endif