ArmorSet.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // ArmorSet.h
  24. #pragma once
  25. #ifndef _ArmorSet_H_
  26. #define _ArmorSet_H_
  27. #include "Lib/BaseType.h"
  28. #include "Common/GameType.h"
  29. #include "Common/SparseMatchFinder.h"
  30. #include "Common/SparseMatchFinder.h"
  31. //-------------------------------------------------------------------------------------------------
  32. class ArmorTemplate;
  33. class DamageFX;
  34. class INI;
  35. //-------------------------------------------------------------------------------------------------
  36. // IMPORTANT NOTE: you should endeavor to set up states such that the most "normal"
  37. // state is defined by the bit being off. That is, the typical "normal" condition
  38. // has all condition flags set to zero.
  39. enum ArmorSetType
  40. {
  41. // The access and use of this enum has the bit shifting built in, so this is a 0,1,2,3,4,5 enum
  42. ARMORSET_VETERAN = 0,
  43. ARMORSET_ELITE = 1,
  44. ARMORSET_HERO = 2,
  45. ARMORSET_PLAYER_UPGRADE = 3,
  46. ARMORSET_WEAK_VERSUS_BASEDEFENSES = 4,
  47. ARMORSET_SECOND_LIFE = 5, ///< Body Module has marked us as on our second life
  48. ARMORSET_CRATE_UPGRADE_ONE, ///< Just like weaponset type from salvage.
  49. ARMORSET_CRATE_UPGRADE_TWO,
  50. ARMORSET_COUNT ///< keep last, please
  51. };
  52. //-------------------------------------------------------------------------------------------------
  53. typedef BitFlags<ARMORSET_COUNT> ArmorSetFlags;
  54. //-------------------------------------------------------------------------------------------------
  55. class ArmorTemplateSet
  56. {
  57. private:
  58. ArmorSetFlags m_types;
  59. const ArmorTemplate* m_template;
  60. const DamageFX* m_fx;
  61. public:
  62. inline ArmorTemplateSet()
  63. {
  64. clear();
  65. }
  66. inline void clear()
  67. {
  68. m_types.clear();
  69. m_template = NULL;
  70. m_fx = NULL;
  71. }
  72. inline const ArmorTemplate* getArmorTemplate() const { return m_template; }
  73. inline const DamageFX* getDamageFX() const { return m_fx; }
  74. inline Int getConditionsYesCount() const { return 1; }
  75. inline const ArmorSetFlags& getNthConditionsYes(Int i) const { return m_types; }
  76. #if defined(_DEBUG) || defined(_INTERNAL)
  77. inline AsciiString getDescription() const { return AsciiString("ArmorTemplateSet"); }
  78. #endif
  79. void parseArmorTemplateSet( INI* ini );
  80. };
  81. //-------------------------------------------------------------------------------------------------
  82. typedef std::vector<ArmorTemplateSet> ArmorTemplateSetVector;
  83. //-------------------------------------------------------------------------------------------------
  84. typedef SparseMatchFinder<ArmorTemplateSet, ArmorSetFlags> ArmorTemplateSetFinder;
  85. #endif // _ArmorSet_H_