objlibrary.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. ** Command & Conquer Renegade(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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/objlibrary.cpp $*
  25. * *
  26. * $Author:: Patrick $*
  27. * *
  28. * $Modtime:: 10/23/01 12:14p $*
  29. * *
  30. * $Revision:: 91 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "objlibrary.h"
  36. #include "debug.h"
  37. #include "wwhack.h"
  38. #include "wwdebug.h"
  39. #include "wwmemlog.h"
  40. #include "definition.h"
  41. #include "definitionfactory.h"
  42. #include "definitionmgr.h"
  43. /*
  44. **
  45. */
  46. PhysicalGameObj *ObjectLibraryManager::Create_Object( int def_id )
  47. {
  48. WWMEMLOG(MEM_GAMEDATA);
  49. DefinitionClass * def = DefinitionMgrClass::Find_Definition( def_id );
  50. StringClass error_message;
  51. if ((def != NULL) && (CLASSID_GAME_OBJECTS == SuperClassID_From_ClassID(def->Get_Class_ID()))) {
  52. if (def->Is_Valid_Config(error_message)) {
  53. return (PhysicalGameObj *)def->Create();
  54. } else {
  55. WWDEBUG_SAY(("Could not create object %s!\n%s\n",def->Get_Name(),error_message));
  56. return NULL;
  57. }
  58. }
  59. WWDEBUG_SAY(( "Didn't find Definition of (%d)\n", def_id ));
  60. return NULL;
  61. }
  62. PhysicalGameObj *ObjectLibraryManager::Create_Object( const char *name )
  63. {
  64. WWMEMLOG(MEM_GAMEDATA);
  65. DefinitionClass * def = DefinitionMgrClass::Find_Typed_Definition( name, CLASSID_GAME_OBJECTS );
  66. StringClass error_message;
  67. // if ( def && CLASSID_GAME_OBJECTS == SuperClassID_From_ClassID(def->Get_Class_ID())) {
  68. if ( def ) {
  69. if (def->Is_Valid_Config(error_message)) {
  70. return (PhysicalGameObj *)def->Create();
  71. } else {
  72. WWDEBUG_SAY(("Could not create object %s!\n%s\n",def->Get_Name(),error_message));
  73. return NULL;
  74. }
  75. } else if ( def ) {
  76. WWDEBUG_SAY(( "Found Definition for %s, but is was the wrong type\n", name ));
  77. }
  78. WWDEBUG_SAY(( "Didn't find Definition of \"%s\"\n", name ));
  79. return NULL;
  80. }
  81. /*
  82. **
  83. */
  84. void Force_Link_Combat( void )
  85. {
  86. FORCE_LINK( C4 );
  87. FORCE_LINK( PowerUp );
  88. FORCE_LINK( SAMSite );
  89. FORCE_LINK( Simple );
  90. FORCE_LINK( Soldier );
  91. FORCE_LINK( Vehicle );
  92. FORCE_LINK( Zone );
  93. FORCE_LINK( DamageZone );
  94. FORCE_LINK( Transition );
  95. FORCE_LINK( Cinematic );
  96. FORCE_LINK( SpecialEffects );
  97. FORCE_LINK( SakuraBoss );
  98. FORCE_LINK( MendozaBoss );
  99. FORCE_LINK( RaveshawBoss );
  100. FORCE_LINK( Beacon );
  101. FORCE_LINK( PowerPlant );
  102. FORCE_LINK( SoldierFactory );
  103. FORCE_LINK( VehicleFactory );
  104. FORCE_LINK( Refinery );
  105. FORCE_LINK( ComCenter );
  106. FORCE_LINK( RepairBay );
  107. FORCE_LINK( AirStrip );
  108. FORCE_LINK( WarFactory );
  109. FORCE_LINK( doorphys );
  110. FORCE_LINK( elevatorphys );
  111. FORCE_LINK( damageablestaticphys );
  112. FORCE_LINK( buildingaggregate );
  113. FORCE_LINK( GlobalSettings );
  114. FORCE_LINK( EvaSettings );
  115. FORCE_LINK( CharClassSettings );
  116. FORCE_LINK( OratorTypes );
  117. FORCE_LINK( PurchaseSettings );
  118. FORCE_LINK( TeamPurchaseSettings );
  119. }