CCINI.H 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/CCINI.H 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : CCINI.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 05/24/96 *
  26. * *
  27. * Last Update : May 24, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef CCINI_H
  33. #define CCINI_H
  34. #include "ini.h"
  35. #include "fixed.h"
  36. #include "pk.h"
  37. class TriggerTypeClass;
  38. /*
  39. ** The advanced version of the INI database manager. It handles the C&C expansion types and
  40. ** identifiers. In addition, it automatically stores a message digest with the INI data
  41. ** so that verification can occur.
  42. */
  43. class CCINIClass : public INIClass
  44. {
  45. public:
  46. CCINIClass(void) : IsDigestPresent(false) {}
  47. bool Load(FileClass & file, bool withdigest);
  48. int Load(Straw & file, bool withdigest);
  49. int Save(FileClass & file, bool withdigest) const;
  50. int Save(Pipe & pipe, bool withdigest) const;
  51. long Get_Buildings(char const * section, char const * entry, long defvalue) const;
  52. UnitType Get_UnitType(char const * section, char const * entry, UnitType defvalue) const;
  53. AnimType Get_AnimType(char const * section, char const * entry, AnimType defvalue) const;
  54. ArmorType Get_ArmorType(char const * section, char const * entry, ArmorType defvalue) const;
  55. BulletType Get_BulletType(char const * section, char const * entry, BulletType defvalue) const;
  56. HousesType Get_HousesType(char const * section, char const * entry, HousesType defvalue) const;
  57. LEPTON Get_Lepton(char const * section, char const * entry, LEPTON defvalue) const;
  58. MPHType Get_MPHType(char const * section, char const * entry, MPHType defvalue) const;
  59. OverlayType Get_OverlayType(char const * section, char const * entry, OverlayType defvalue) const;
  60. SourceType Get_SourceType(char const * section, char const * entry, SourceType defvalue) const;
  61. TerrainType Get_TerrainType(char const * section, char const * entry, TerrainType defvalue) const;
  62. TheaterType Get_TheaterType(char const * section, char const * entry, TheaterType defvalue) const;
  63. ThemeType Get_ThemeType(char const * section, char const * entry, ThemeType defvalue) const;
  64. TriggerTypeClass * Get_TriggerType(char const * section, char const * entry) const;
  65. VQType Get_VQType(char const * section, char const * entry, VQType defvalue) const;
  66. VocType Get_VocType(char const * section, char const * entry, VocType defvalue) const;
  67. WarheadType Get_WarheadType(char const * section, char const * entry, WarheadType defvalue) const;
  68. WeaponType Get_WeaponType(char const * section, char const * entry, WeaponType defvalue) const;
  69. long Get_Owners(char const * section, char const * entry, long defvalue) const;
  70. CrateType Get_CrateType(char const * section, char const * entry, CrateType defvalue) const;
  71. bool Put_Buildings(char const * section, char const * entry, long value);
  72. bool Put_AnimType(char const * section, char const * entry, AnimType value);
  73. bool Put_UnitType(char const * section, char const * entry, UnitType value);
  74. bool Put_ArmorType(char const * section, char const * entry, ArmorType value);
  75. bool Put_BulletType(char const * section, char const * entry, BulletType value);
  76. bool Put_HousesType(char const * section, char const * entry, HousesType value);
  77. bool Put_Lepton(char const * section, char const * entry, LEPTON value);
  78. bool Put_MPHType(char const * section, char const * entry, MPHType value);
  79. bool Put_VQType(char const * section, char const * entry, VQType value);
  80. bool Put_OverlayType(char const * section, char const * entry, OverlayType value);
  81. bool Put_Owners(char const * section, char const * entry, long value);
  82. bool Put_SourceType(char const * section, char const * entry, SourceType value);
  83. bool Put_TerrainType(char const * section, char const * entry, TerrainType value);
  84. bool Put_TheaterType(char const * section, char const * entry, TheaterType value);
  85. bool Put_ThemeType(char const * section, char const * entry, ThemeType value);
  86. bool Put_TriggerType(char const * section, char const * entry, TriggerTypeClass * value);
  87. bool Put_VocType(char const * section, char const * entry, VocType value);
  88. bool Put_WarheadType(char const * section, char const * entry, WarheadType value);
  89. bool Put_WeaponType(char const * section, char const * entry, WeaponType value);
  90. bool Put_CrateType(char const * section, char const * entry, CrateType value);
  91. int Get_Unique_ID(void) const;
  92. private:
  93. void Calculate_Message_Digest(void);
  94. void Invalidate_Message_Digest(void);
  95. bool IsDigestPresent:1;
  96. /*
  97. ** This is the message digest (SHA) of the INI database that was embedded as part of
  98. ** the INI file.
  99. */
  100. unsigned char Digest[20];
  101. };
  102. #endif