SpecialAbility.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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: 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. #ifdef _INTERNAL
  38. // for occasional debugging...
  39. //#pragma optimize("", off)
  40. //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
  41. #endif
  42. // ------------------------------------------------------------------------------------------------
  43. // ------------------------------------------------------------------------------------------------
  44. SpecialAbility::SpecialAbility( Thing *thing, const ModuleData *moduleData )
  45. : SpecialPowerModule( thing, moduleData )
  46. {
  47. } // end SpecialAbility
  48. // ------------------------------------------------------------------------------------------------
  49. // ------------------------------------------------------------------------------------------------
  50. SpecialAbility::~SpecialAbility( void )
  51. {
  52. } // end ~SpecialAbility
  53. // ------------------------------------------------------------------------------------------------
  54. // ------------------------------------------------------------------------------------------------
  55. void SpecialAbility::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, UnsignedInt commandOptions )
  56. {
  57. if (getObject()->isDisabled())
  58. return;
  59. // sanity
  60. if( loc == NULL )
  61. return;
  62. // call the base class action cause we are *EXTENDING* functionality
  63. SpecialPowerModule::doSpecialPowerAtLocation( loc, angle, commandOptions );
  64. }
  65. // ------------------------------------------------------------------------------------------------
  66. // ------------------------------------------------------------------------------------------------
  67. void SpecialAbility::doSpecialPowerAtObject( Object *obj, UnsignedInt commandOptions )
  68. {
  69. if (getObject()->isDisabled())
  70. return;
  71. if (!obj)
  72. return;
  73. // call the base class action cause we are *EXTENDING* functionality
  74. SpecialPowerModule::doSpecialPowerAtObject( obj, commandOptions );
  75. }
  76. // ------------------------------------------------------------------------------------------------
  77. // ------------------------------------------------------------------------------------------------
  78. void SpecialAbility::doSpecialPower( UnsignedInt commandOptions )
  79. {
  80. if (getObject()->isDisabled())
  81. return;
  82. // call the base class action cause we are *EXTENDING* functionality
  83. SpecialPowerModule::doSpecialPower( commandOptions );
  84. }
  85. // ------------------------------------------------------------------------------------------------
  86. /** CRC */
  87. // ------------------------------------------------------------------------------------------------
  88. void SpecialAbility::crc( Xfer *xfer )
  89. {
  90. // extend base class
  91. SpecialPowerModule::crc( xfer );
  92. } // end crc
  93. // ------------------------------------------------------------------------------------------------
  94. /** Xfer method
  95. * Version Info:
  96. * 1: Initial version */
  97. // ------------------------------------------------------------------------------------------------
  98. void SpecialAbility::xfer( Xfer *xfer )
  99. {
  100. // version
  101. XferVersion currentVersion = 1;
  102. XferVersion version = currentVersion;
  103. xfer->xferVersion( &version, currentVersion );
  104. // extend base class
  105. SpecialPowerModule::xfer( xfer );
  106. } // end xfer
  107. // ------------------------------------------------------------------------------------------------
  108. /** Load post process */
  109. // ------------------------------------------------------------------------------------------------
  110. void SpecialAbility::loadPostProcess( void )
  111. {
  112. // extend base class
  113. SpecialPowerModule::loadPostProcess();
  114. } // end loadPostProcess