purchasesettings.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Combat *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/purchasesettings.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 1/05/02 5:14p $*
  29. * *
  30. * $Revision:: 6 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __PURCHASESETTINGS_H
  39. #define __PURCHASESETTINGS_H
  40. #include "always.h"
  41. #include "definition.h"
  42. #include "widestring.h"
  43. ///////////////////////////////////////////////////////////////////////////////////////////
  44. //
  45. // PurchaseSettingsDefClass
  46. //
  47. ///////////////////////////////////////////////////////////////////////////////////////////
  48. class PurchaseSettingsDefClass : public DefinitionClass
  49. {
  50. public:
  51. //////////////////////////////////////////////////////////////////////////
  52. // Public constants
  53. //////////////////////////////////////////////////////////////////////////
  54. typedef enum
  55. {
  56. TYPE_CLASSES = 0,
  57. TYPE_VEHICLES,
  58. TYPE_EQUIPMENT,
  59. TYPE_SECRET_CLASSES,
  60. TYPE_SECRET_VEHICLES,
  61. TYPE_COUNT
  62. } TYPE;
  63. typedef enum
  64. {
  65. TEAM_GDI = 0,
  66. TEAM_NOD,
  67. TEAM_MUTANT_GDI,
  68. TEAM_MUTANT_NOD,
  69. TEAM_COUNT
  70. } TEAM;
  71. //////////////////////////////////////////////////////////////////////////
  72. // Public constructors/destructors
  73. //////////////////////////////////////////////////////////////////////////
  74. PurchaseSettingsDefClass (void);
  75. ~PurchaseSettingsDefClass (void);
  76. //////////////////////////////////////////////////////////////////////////
  77. // Public methods
  78. //////////////////////////////////////////////////////////////////////////
  79. //
  80. // From DefinitionClass
  81. //
  82. virtual uint32 Get_Class_ID (void) const;
  83. virtual PersistClass * Create (void) const ;
  84. virtual bool Save (ChunkSaveClass &csave);
  85. virtual bool Load (ChunkLoadClass &cload);
  86. virtual const PersistFactoryClass & Get_Factory (void) const;
  87. //
  88. // Accessors
  89. //
  90. TYPE Get_Type (void) { return Type; }
  91. TEAM Get_Team (void) { return Team; }
  92. const WCHAR * Get_Name (int index);
  93. int Get_Cost (int index) { return CostList[index]; }
  94. int Get_Definition (int index) { return DefinitionList[index]; }
  95. const StringClass & Get_Texture (int index) { return TextureList[index]; }
  96. const WCHAR * Get_Enlisted_Name (int index);
  97. int Get_Enlisted_Definition (int index) { return DefinitionList[index]; }
  98. const StringClass & Get_Enlisted_Texture (int index) { return TextureList[index]; }
  99. //
  100. // Alternate support
  101. //
  102. int Get_Alt_Definition (int index, int alt_index) { return AlternateDefinitionList[index][alt_index]; }
  103. const StringClass & Get_Alt_Texture (int index, int alt_index) { return AlternateTextureList[index][alt_index]; }
  104. //
  105. // Singleton access
  106. //
  107. static PurchaseSettingsDefClass * Find_Definition (TYPE type, TEAM team);
  108. //
  109. // Editable support
  110. //
  111. DECLARE_EDITABLE (PurchaseSettingsDefClass, DefinitionClass);
  112. protected:
  113. //////////////////////////////////////////////////////////////////////////
  114. // Protected methods
  115. //////////////////////////////////////////////////////////////////////////
  116. void Load_Variables (ChunkLoadClass &cload);
  117. //////////////////////////////////////////////////////////////////////////
  118. // Protected constants
  119. //////////////////////////////////////////////////////////////////////////
  120. enum
  121. {
  122. ROWS = 4,
  123. COLS = 5,
  124. MAX_ALTERNATES = 3,
  125. MAX_ENTRIES = 10
  126. };
  127. //////////////////////////////////////////////////////////////////////////
  128. // Protected member data
  129. //////////////////////////////////////////////////////////////////////////
  130. TEAM Team;
  131. TYPE Type;
  132. int CostList[MAX_ENTRIES];
  133. int DefinitionList[MAX_ENTRIES];
  134. int NameList[MAX_ENTRIES];
  135. StringClass TextureList[MAX_ENTRIES];
  136. int AlternateDefinitionList[MAX_ENTRIES][MAX_ALTERNATES];
  137. StringClass AlternateTextureList[MAX_ENTRIES][MAX_ALTERNATES];
  138. static PurchaseSettingsDefClass * DefinitionArray[TYPE_COUNT][TEAM_COUNT];
  139. };
  140. #endif //__PURCHASESETTINGS_H