StructureBody.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: StructureBody.cpp ////////////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, November 2001
  25. // Desc: Structure bodies are active bodies specifically for structures that are built
  26. // and/or interactable (is that a world) with the player.
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////
  28. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  29. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  30. #include "Common/Xfer.h"
  31. #include "GameLogic/Object.h"
  32. #include "GameLogic/Damage.h"
  33. #include "GameLogic/Module/StructureBody.h"
  34. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
  35. //-------------------------------------------------------------------------------------------------
  36. //-------------------------------------------------------------------------------------------------
  37. StructureBody::StructureBody( Thing *thing, const ModuleData* moduleData )
  38. : ActiveBody( thing, moduleData )
  39. {
  40. m_constructorObjectID = INVALID_ID;
  41. } // end StructureBody
  42. //-------------------------------------------------------------------------------------------------
  43. //-------------------------------------------------------------------------------------------------
  44. StructureBody::~StructureBody( void )
  45. {
  46. } // end ~StructureBody
  47. //-------------------------------------------------------------------------------------------------
  48. //-------------------------------------------------------------------------------------------------
  49. void StructureBody::setConstructorObject( Object *obj )
  50. {
  51. if( obj )
  52. m_constructorObjectID = obj->getID();
  53. } // end setConstructorObject
  54. // ------------------------------------------------------------------------------------------------
  55. /** CRC */
  56. // ------------------------------------------------------------------------------------------------
  57. void StructureBody::crc( Xfer *xfer )
  58. {
  59. // extend base class
  60. ActiveBody::crc( xfer );
  61. } // end crc
  62. // ------------------------------------------------------------------------------------------------
  63. /** Xfer method
  64. * Version Info:
  65. * 1: Initial version */
  66. // ------------------------------------------------------------------------------------------------
  67. void StructureBody::xfer( Xfer *xfer )
  68. {
  69. // version
  70. XferVersion currentVersion = 1;
  71. XferVersion version = currentVersion;
  72. xfer->xferVersion( &version, currentVersion );
  73. // base class
  74. ActiveBody::xfer( xfer );
  75. // constructor object id
  76. xfer->xferObjectID( &m_constructorObjectID );
  77. } // end xfer
  78. // ------------------------------------------------------------------------------------------------
  79. /** Load post process */
  80. // ------------------------------------------------------------------------------------------------
  81. void StructureBody::loadPostProcess( void )
  82. {
  83. // extend base class
  84. ActiveBody::loadPostProcess();
  85. } // end loadPostProcess