CommandSetUpgrade.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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: CommandSetUpgrade.cpp /////////////////////////////////////////////////////////////////////////////
  24. // Author: Graham Smallwood, September 2002
  25. // Desc: UpgradeModule that sets a new override string for Command Set look ups
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  28. #include "Common/Xfer.h"
  29. #include "GameClient/ControlBar.h"
  30. #include "GameLogic/Module/CommandSetUpgrade.h"
  31. #include "GameLogic/Object.h"
  32. // ------------------------------------------------------------------------------------------------
  33. // ------------------------------------------------------------------------------------------------
  34. void CommandSetUpgradeModuleData::buildFieldParse(MultiIniFieldParse& p)
  35. {
  36. UpgradeModuleData::buildFieldParse(p);
  37. static const FieldParse dataFieldParse[] =
  38. {
  39. { "CommandSet", INI::parseAsciiString, NULL, offsetof( CommandSetUpgradeModuleData, m_newCommandSet ) },
  40. { 0, 0, 0, 0 }
  41. };
  42. p.add(dataFieldParse);
  43. }
  44. //-------------------------------------------------------------------------------------------------
  45. //-------------------------------------------------------------------------------------------------
  46. CommandSetUpgrade::CommandSetUpgrade( Thing *thing, const ModuleData* moduleData ) : UpgradeModule( thing, moduleData )
  47. {
  48. }
  49. //-------------------------------------------------------------------------------------------------
  50. //-------------------------------------------------------------------------------------------------
  51. CommandSetUpgrade::~CommandSetUpgrade( void )
  52. {
  53. }
  54. //-------------------------------------------------------------------------------------------------
  55. //-------------------------------------------------------------------------------------------------
  56. void CommandSetUpgrade::upgradeImplementation( )
  57. {
  58. Object *obj = getObject();
  59. obj->setCommandSetStringOverride( getCommandSetUpgradeModuleData()->m_newCommandSet );
  60. TheControlBar->markUIDirty();// Refresh the UI in case we are selected
  61. }
  62. // ------------------------------------------------------------------------------------------------
  63. /** CRC */
  64. // ------------------------------------------------------------------------------------------------
  65. void CommandSetUpgrade::crc( Xfer *xfer )
  66. {
  67. // extend base class
  68. UpgradeModule::crc( xfer );
  69. } // end crc
  70. // ------------------------------------------------------------------------------------------------
  71. /** Xfer method
  72. * Version Info:
  73. * 1: Initial version */
  74. // ------------------------------------------------------------------------------------------------
  75. void CommandSetUpgrade::xfer( Xfer *xfer )
  76. {
  77. // version
  78. XferVersion currentVersion = 1;
  79. XferVersion version = currentVersion;
  80. xfer->xferVersion( &version, currentVersion );
  81. // extend base class
  82. UpgradeModule::xfer( xfer );
  83. } // end xfer
  84. // ------------------------------------------------------------------------------------------------
  85. /** Load post process */
  86. // ------------------------------------------------------------------------------------------------
  87. void CommandSetUpgrade::loadPostProcess( void )
  88. {
  89. // extend base class
  90. UpgradeModule::loadPostProcess();
  91. } // end loadPostProcess