INIControlBarScheme.cpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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: INIControlBarScheme.cpp /////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Apr 2002
  34. //
  35. // Filename: INIControlBarScheme.cpp
  36. //
  37. // author: Chris Huybregts
  38. //
  39. // purpose: Parse a control Bar Scheme
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. //-----------------------------------------------------------------------------
  44. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  45. //-----------------------------------------------------------------------------
  46. //-----------------------------------------------------------------------------
  47. // USER INCLUDES //////////////////////////////////////////////////////////////
  48. //-----------------------------------------------------------------------------
  49. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  50. #include "Common/INI.h"
  51. #include "GameClient/ControlBar.h"
  52. #include "GameClient/ControlBarScheme.h"
  53. //-----------------------------------------------------------------------------
  54. // DEFINES ////////////////////////////////////////////////////////////////////
  55. //-----------------------------------------------------------------------------
  56. //-----------------------------------------------------------------------------
  57. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
  58. //-----------------------------------------------------------------------------
  59. //-----------------------------------------------------------------------------
  60. // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
  61. //-----------------------------------------------------------------------------
  62. //-------------------------------------------------------------------------------------------------
  63. /** Parse a ControlBarScheme button */
  64. //-------------------------------------------------------------------------------------------------
  65. void INI::parseControlBarSchemeDefinition( INI *ini )
  66. {
  67. AsciiString name;
  68. ControlBarSchemeManager *CBSchemeManager;
  69. ControlBarScheme *CBScheme;
  70. // read the name
  71. const char* c = ini->getNextToken();
  72. name.set( c );
  73. // find existing item if present
  74. CBSchemeManager = TheControlBar->getControlBarSchemeManager();
  75. DEBUG_ASSERTCRASH( CBSchemeManager, ("parseControlBarSchemeDefinition: Unable to Get CBSchemeManager\n") );
  76. if( !CBSchemeManager )
  77. return;
  78. // If we have a previously allocated control bar, this will return a cleared out pointer to it so we
  79. // can overwrite it
  80. CBScheme = CBSchemeManager->newControlBarScheme( name );
  81. // sanity
  82. DEBUG_ASSERTCRASH( CBScheme, ("parseControlBarSchemeDefinition: Unable to allocate Scheme '%s'\n", name.str()) );
  83. // parse the ini definition
  84. ini->initFromINI( CBScheme, CBSchemeManager->getFieldParse() );
  85. } // end parseCommandButtonDefinition