SpecialAbility.cpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. // FILE: SpecialAbility.cpp /////////////////////////////////////////////////////////////
  24. // Author: Kris Morness, July 2002
  25. // Desc: This is the class that handles processing of any special attack from a unit. There are
  26. // many different styles and rules for various attacks.
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////
  28. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  29. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  30. #include "Common/Player.h"
  31. #include "Common/Xfer.h"
  32. #include "GameLogic/Object.h"
  33. #include "GameLogic/Module/SpecialAbility.h"
  34. ///////////////////////////////////////////////////////////////////////////////////////////////////
  35. ///////////////////////////////////////////////////////////////////////////////////////////////////
  36. ///////////////////////////////////////////////////////////////////////////////////////////////////
  37. // ------------------------------------------------------------------------------------------------
  38. // ------------------------------------------------------------------------------------------------
  39. SpecialAbility::SpecialAbility( Thing *thing, const ModuleData *moduleData )
  40. : SpecialPowerModule( thing, moduleData )
  41. {
  42. } // end SpecialAbility
  43. // ------------------------------------------------------------------------------------------------
  44. // ------------------------------------------------------------------------------------------------
  45. SpecialAbility::~SpecialAbility( void )
  46. {
  47. } // end ~SpecialAbility
  48. // ------------------------------------------------------------------------------------------------
  49. // ------------------------------------------------------------------------------------------------
  50. void SpecialAbility::doSpecialPowerAtLocation( const Coord3D *loc, UnsignedInt commandOptions )
  51. {
  52. if (getObject()->isDisabled())
  53. return;
  54. // sanity
  55. if( loc == NULL )
  56. return;
  57. // call the base class action cause we are *EXTENDING* functionality
  58. SpecialPowerModule::doSpecialPowerAtLocation( loc, commandOptions );
  59. }
  60. // ------------------------------------------------------------------------------------------------
  61. // ------------------------------------------------------------------------------------------------
  62. void SpecialAbility::doSpecialPowerAtObject( Object *obj, UnsignedInt commandOptions )
  63. {
  64. if (getObject()->isDisabled())
  65. return;
  66. if (!obj)
  67. return;
  68. // call the base class action cause we are *EXTENDING* functionality
  69. SpecialPowerModule::doSpecialPowerAtObject( obj, commandOptions );
  70. }
  71. // ------------------------------------------------------------------------------------------------
  72. // ------------------------------------------------------------------------------------------------
  73. void SpecialAbility::doSpecialPower( UnsignedInt commandOptions )
  74. {
  75. if (getObject()->isDisabled())
  76. return;
  77. // call the base class action cause we are *EXTENDING* functionality
  78. SpecialPowerModule::doSpecialPower( commandOptions );
  79. }
  80. // ------------------------------------------------------------------------------------------------
  81. /** CRC */
  82. // ------------------------------------------------------------------------------------------------
  83. void SpecialAbility::crc( Xfer *xfer )
  84. {
  85. // extend base class
  86. SpecialPowerModule::crc( xfer );
  87. } // end crc
  88. // ------------------------------------------------------------------------------------------------
  89. /** Xfer method
  90. * Version Info:
  91. * 1: Initial version */
  92. // ------------------------------------------------------------------------------------------------
  93. void SpecialAbility::xfer( Xfer *xfer )
  94. {
  95. // version
  96. XferVersion currentVersion = 1;
  97. XferVersion version = currentVersion;
  98. xfer->xferVersion( &version, currentVersion );
  99. // extend base class
  100. SpecialPowerModule::xfer( xfer );
  101. } // end xfer
  102. // ------------------------------------------------------------------------------------------------
  103. /** Load post process */
  104. // ------------------------------------------------------------------------------------------------
  105. void SpecialAbility::loadPostProcess( void )
  106. {
  107. // extend base class
  108. SpecialPowerModule::loadPostProcess();
  109. } // end loadPostProcess