ActiveShroudUpgrade.cpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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: ActiveShroudUpgrade.cpp ///////////////////////////////////////////////////////////////////////////
  24. // Author: Graham Smallwood, July 2002
  25. // Desc: An upgrade that modifies the object's ShroudRange.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  28. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  29. #include "Common/Xfer.h"
  30. #include "GameLogic/Module/ActiveShroudUpgrade.h"
  31. #include "GameLogic/Object.h"
  32. //-------------------------------------------------------------------------------------------------
  33. //-------------------------------------------------------------------------------------------------
  34. ActiveShroudUpgradeModuleData::ActiveShroudUpgradeModuleData( void )
  35. {
  36. m_newShroudRange = 0.0f;
  37. } // end SpecialPowerModuleData
  38. //-------------------------------------------------------------------------------------------------
  39. //-------------------------------------------------------------------------------------------------
  40. /* static */ void ActiveShroudUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p)
  41. {
  42. UpgradeModuleData::buildFieldParse( p );
  43. static const FieldParse dataFieldParse[] =
  44. {
  45. { "NewShroudRange", INI::parseReal, NULL, offsetof( ActiveShroudUpgradeModuleData, m_newShroudRange ) },
  46. { 0, 0, 0, 0 }
  47. };
  48. p.add(dataFieldParse);
  49. } // end buildFieldParse
  50. ///////////////////////////////////////////////////////////////////////////////////////////////////
  51. ///////////////////////////////////////////////////////////////////////////////////////////////////
  52. ///////////////////////////////////////////////////////////////////////////////////////////////////
  53. //-------------------------------------------------------------------------------------------------
  54. //-------------------------------------------------------------------------------------------------
  55. ActiveShroudUpgrade::ActiveShroudUpgrade( Thing *thing, const ModuleData* moduleData ) :
  56. UpgradeModule( thing, moduleData )
  57. {
  58. } // end ActiveShroudUpgrade
  59. //-------------------------------------------------------------------------------------------------
  60. //-------------------------------------------------------------------------------------------------
  61. ActiveShroudUpgrade::~ActiveShroudUpgrade( void )
  62. {
  63. } // end ~ActiveShroudUpgrade
  64. //-------------------------------------------------------------------------------------------------
  65. //-------------------------------------------------------------------------------------------------
  66. void ActiveShroudUpgrade::upgradeImplementation( void )
  67. {
  68. // Set my object's ability to actively shroud.
  69. if( getActiveShroudUpgradeModuleData() )
  70. {
  71. getObject()->setShroudRange( getActiveShroudUpgradeModuleData()->m_newShroudRange );
  72. getObject()->handlePartitionCellMaintenance();// To shroud where I am without waiting.
  73. }
  74. } // end upgradeImplementation
  75. // ------------------------------------------------------------------------------------------------
  76. /** CRC */
  77. // ------------------------------------------------------------------------------------------------
  78. void ActiveShroudUpgrade::crc( Xfer *xfer )
  79. {
  80. // extend base class
  81. UpgradeModule::crc( xfer );
  82. } // end crc
  83. // ------------------------------------------------------------------------------------------------
  84. /** Xfer method
  85. * Version Info:
  86. * 1: Initial version */
  87. // ------------------------------------------------------------------------------------------------
  88. void ActiveShroudUpgrade::xfer( Xfer *xfer )
  89. {
  90. // version
  91. XferVersion currentVersion = 1;
  92. XferVersion version = currentVersion;
  93. xfer->xferVersion( &version, currentVersion );
  94. // extend base class
  95. UpgradeModule::xfer( xfer );
  96. } // end xfer
  97. // ------------------------------------------------------------------------------------------------
  98. /** Load post process */
  99. // ------------------------------------------------------------------------------------------------
  100. void ActiveShroudUpgrade::loadPostProcess( void )
  101. {
  102. // extend base class
  103. UpgradeModule::loadPostProcess();
  104. } // end loadPostProcess