SpecialPowerUpdateModule.cpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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: SpecialPowerUpdateModule.cpp ///////////////////////////////////////////////////////////////////
  24. // Author: Kris Morness, July 2003
  25. // Desc: Special power update module interface
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  28. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  29. #include "Common/Player.h"
  30. #include "Common/PlayerList.h"
  31. #include "Common/Science.h"
  32. #include "Common/SpecialPower.h"
  33. #include "Common/Xfer.h"
  34. #include "GameLogic/GameLogic.h"
  35. #include "GameLogic/Object.h"
  36. #include "GameLogic/Module/SpecialPowerUpdateModule.h"
  37. #include "GameLogic/Module/SpecialPowerModule.h"
  38. #ifdef _INTERNAL
  39. // for occasional debugging...
  40. //#pragma optimize("", off)
  41. //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
  42. #endif
  43. //-------------------------------------------------------------------------------------------------
  44. SpecialPowerUpdateModule::SpecialPowerUpdateModule( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData )
  45. {
  46. }
  47. //-------------------------------------------------------------------------------------------------
  48. SpecialPowerUpdateModule::~SpecialPowerUpdateModule()
  49. {
  50. }
  51. //-------------------------------------------------------------------------------------------------
  52. Bool SpecialPowerUpdateModule::doesSpecialPowerUpdatePassScienceTest() const
  53. {
  54. //Kris: July 24, 2003 -- Added an additional optional check for objects with multiple SpecialPowerModules referencing
  55. //the same SpecialPowerTemplate but with special ScienceType checks. An example of this is the three
  56. //SpectreGunshipDeploymentUpdate modules inside AirF_AmericaCommandCenter. Each one has a different duration which
  57. //is hooked into different objects. This sucked and became necessary because the way the stackable changable icon system
  58. //for multilevel buttons.
  59. ScienceType science = getExtraRequiredScience();
  60. if( science != SCIENCE_INVALID )
  61. {
  62. if( getObject()->getControllingPlayer()->hasScience( science ) )
  63. {
  64. //We have the science.
  65. return TRUE;
  66. }
  67. //We don't have the science.
  68. return FALSE;
  69. }
  70. //We don't have this extra check
  71. return TRUE;
  72. }
  73. //------------------------------------------------------------------------------------------------
  74. /** CRC */
  75. //------------------------------------------------------------------------------------------------
  76. void SpecialPowerUpdateModule::crc( Xfer *xfer )
  77. {
  78. // extend base class
  79. UpdateModule::crc( xfer );
  80. } // end crc
  81. //------------------------------------------------------------------------------------------------
  82. /** Xfer method
  83. * Version Info:
  84. * 1: Initial version */
  85. //------------------------------------------------------------------------------------------------
  86. void SpecialPowerUpdateModule::xfer( Xfer *xfer )
  87. {
  88. // version
  89. XferVersion currentVersion = 1;
  90. XferVersion version = currentVersion;
  91. xfer->xferVersion( &version, currentVersion );
  92. // extend base class
  93. UpdateModule::xfer( xfer );
  94. } // end xfer
  95. //------------------------------------------------------------------------------------------------
  96. /** Load post process */
  97. //------------------------------------------------------------------------------------------------
  98. void SpecialPowerUpdateModule::loadPostProcess( void )
  99. {
  100. // extend base class
  101. UpdateModule::loadPostProcess();
  102. } // end loadPostProcess