VeterancyCrateCollide.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. // FILE: VeterancyCrateCollide.h /////////////////////////////////////////////////////////////////////////
  24. // Author: Graham Smallwood, March 2002
  25. // Desc: A crate that gives a level of experience to all within n distance
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef VETERANCY_CRATE_COLLIDE_H_
  29. #define VETERANCY_CRATE_COLLIDE_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/Module.h"
  32. #include "GameLogic/Module/CrateCollide.h"
  33. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  34. class Thing;
  35. //-------------------------------------------------------------------------------------------------
  36. class VeterancyCrateCollideModuleData : public CrateCollideModuleData
  37. {
  38. public:
  39. UnsignedInt m_rangeOfEffect;
  40. Bool m_addsOwnerVeterancy;
  41. Bool m_isPilot;
  42. VeterancyCrateCollideModuleData()
  43. {
  44. m_rangeOfEffect = 0;
  45. m_addsOwnerVeterancy = false;
  46. m_isPilot = false;
  47. }
  48. static void buildFieldParse(MultiIniFieldParse& p)
  49. {
  50. CrateCollideModuleData::buildFieldParse(p);
  51. static const FieldParse dataFieldParse[] =
  52. {
  53. { "EffectRange", INI::parseUnsignedInt, NULL, offsetof( VeterancyCrateCollideModuleData, m_rangeOfEffect ) },
  54. { "AddsOwnerVeterancy", INI::parseBool, NULL, offsetof( VeterancyCrateCollideModuleData, m_addsOwnerVeterancy ) },
  55. { "IsPilot", INI::parseBool, NULL, offsetof( VeterancyCrateCollideModuleData, m_isPilot ) },
  56. { 0, 0, 0, 0 }
  57. };
  58. p.add(dataFieldParse);
  59. }
  60. };
  61. //-------------------------------------------------------------------------------------------------
  62. class VeterancyCrateCollide : public CrateCollide
  63. {
  64. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( VeterancyCrateCollide, "VeterancyCrateCollide" )
  65. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( VeterancyCrateCollide, VeterancyCrateCollideModuleData );
  66. public:
  67. VeterancyCrateCollide( Thing *thing, const ModuleData* moduleData );
  68. // virtual destructor prototype provided by memory pool declaration
  69. protected:
  70. /// This allows specific vetoes to certain types of crates and their data
  71. virtual Bool isValidToExecute( const Object *other ) const;
  72. /// This is the game logic execution function that all real CrateCollides will implement
  73. virtual Bool executeCrateBehavior( Object *other );
  74. Int getLevelsToGain() const;
  75. };
  76. #endif