ArmorSet.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. ** Command & Conquer Generals(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_COUNT ///< keep last, please
  48. };
  49. //-------------------------------------------------------------------------------------------------
  50. typedef BitFlags<ARMORSET_COUNT> ArmorSetFlags;
  51. //-------------------------------------------------------------------------------------------------
  52. class ArmorTemplateSet
  53. {
  54. private:
  55. ArmorSetFlags m_types;
  56. const ArmorTemplate* m_template;
  57. const DamageFX* m_fx;
  58. public:
  59. inline ArmorTemplateSet()
  60. {
  61. clear();
  62. }
  63. inline void clear()
  64. {
  65. m_types.clear();
  66. m_template = NULL;
  67. m_fx = NULL;
  68. }
  69. inline const ArmorTemplate* getArmorTemplate() const { return m_template; }
  70. inline const DamageFX* getDamageFX() const { return m_fx; }
  71. inline Int getConditionsYesCount() const { return 1; }
  72. inline const ArmorSetFlags& getNthConditionsYes(Int i) const { return m_types; }
  73. #if defined(_DEBUG) || defined(_INTERNAL)
  74. inline AsciiString getDescription() const { return AsciiString("ArmorTemplateSet"); }
  75. #endif
  76. void parseArmorTemplateSet( INI* ini );
  77. };
  78. //-------------------------------------------------------------------------------------------------
  79. typedef std::vector<ArmorTemplateSet> ArmorTemplateSetVector;
  80. //-------------------------------------------------------------------------------------------------
  81. typedef SparseMatchFinder<ArmorTemplateSet, ArmorSetFlags> ArmorTemplateSetFinder;
  82. #endif // _ArmorSet_H_