SIDEBARGlyphx.H 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: F:\projects\c&c\vcs\code\sidebar.h_v 2.18 16 Oct 1995 16:45:24 JOE_BOSTIC $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : SIDEBAR.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : October 20, 1994 *
  26. * *
  27. * Last Update : October 20, 1994 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef SIDEBAR_GLYPHX_H
  33. #define SIDEBAR_GLYPHX_H
  34. #pragma once
  35. #include "function.h"
  36. #include "power.h"
  37. #include "factory.h"
  38. /*
  39. ** ST - 3/14/2019 10:49AM
  40. **
  41. ** We are going to need one sidebar per player for multiplayer with GlyphX. We can't have different maps / cell arrays per
  42. ** player though, so SidebarClass being in the middle of the map/display class hierarchy is a problem.
  43. **
  44. ** All the class static data will have to be made non-static so we can have multiple instances.
  45. **
  46. ** So, this is a stub sidebar class with the functionality we need just to support the exporting of production data to the
  47. ** GlyphX client.
  48. **
  49. **
  50. */
  51. class SidebarGlyphxClass
  52. {
  53. public:
  54. enum SideBarClassEnums {
  55. COLUMNS=2 // Number of side strips on sidebar.
  56. };
  57. SidebarGlyphxClass(void);
  58. /*
  59. ** Initialization
  60. */
  61. void Init_Clear(HouseClass *player_ptr); // Clears all to known state
  62. void Init_IO(void); // Inits button list
  63. void AI(KeyNumType & input, int x, int y);
  64. bool Abandon_Production(RTTIType type, int factory);
  65. bool Add(RTTIType type, int ID, bool via_capture = false);
  66. void Recalc(void);
  67. bool Factory_Link(int factory, RTTIType type, int id);
  68. /*
  69. ** File I/O.
  70. */
  71. void Code_Pointers(void);
  72. void Decode_Pointers(void);
  73. bool Load(Straw &file);
  74. bool Save(Pipe &pipe);
  75. /*
  76. ** Each side strip is managed by this class. It handles all strip specific
  77. ** actions.
  78. */
  79. class StripClass : public StageClass
  80. {
  81. class SelectClass : public ControlClass
  82. {
  83. public:
  84. SelectClass(void);
  85. void Set_Owner(StripClass & strip, int index);
  86. StripClass * Strip;
  87. int Index;
  88. protected:
  89. int Action(unsigned flags, KeyNumType & key);
  90. };
  91. public:
  92. StripClass(void);
  93. bool Add(RTTIType type, int ID, bool via_capture);
  94. bool Abandon_Production(int factory);
  95. bool AI(KeyNumType & input, int x, int y);
  96. void One_Time(int id);
  97. void Init_Clear(void);
  98. void Init_IO(int id);
  99. void Init_Theater(TheaterType theater);
  100. bool Recalc(void);
  101. bool Factory_Link(int factory, RTTIType type, int id);
  102. void const * Get_Special_Cameo(int type);
  103. void Set_Parent_Sidebar(SidebarGlyphxClass *parent) {ParentSidebar = parent;}
  104. /*
  105. ** File I/O.
  106. */
  107. bool Load(FileClass & file);
  108. bool Save(FileClass & file);
  109. //void Code_Pointers(void);
  110. //void Decode_Pointers(void);
  111. /*
  112. ** Working numbers used when rendering and processing the side strip.
  113. */
  114. enum SideBarGeneralEnums {
  115. MAX_BUILDABLES = 75 // Maximum number of object types in sidebar.
  116. };
  117. SidebarGlyphxClass *ParentSidebar;
  118. /*
  119. ** This is a unique identifier for the sidebar strip. Using this identifier,
  120. ** it is possible to differentiate the button messages that arrive from the
  121. ** common input button list. It >MUST< be equal to the strip's index into
  122. ** the Column[] array, because the strip uses it to access the stripclass
  123. ** buttons.
  124. */
  125. int ID;
  126. /*
  127. ** If construction is in progress (no other objects in this strip can
  128. ** be started), then this flag will be true. It will be cleared when
  129. ** the strip is free to start production again.
  130. */
  131. unsigned IsBuilding:1;
  132. /*
  133. ** This is the count of the number of sidebar slots that are active.
  134. */
  135. int BuildableCount;
  136. /*
  137. ** This is the array of buildable object types. This array is sorted in the order
  138. ** that it is to be displayed. This array keeps track of which objects are building
  139. ** and ready to be placed. The very nature of this method precludes simultaneous
  140. ** construction of the same object type.
  141. */
  142. typedef struct BuildType {
  143. int BuildableID;
  144. RTTIType BuildableType;
  145. int Factory; // Production manager.
  146. bool BuildableViaCapture; // Added for new sidebar functionality. ST - 9/24/2019 3:10PM
  147. } BuildType;
  148. BuildType Buildables[MAX_BUILDABLES];
  149. } Column[COLUMNS];
  150. private:
  151. int Which_Column(RTTIType type);
  152. HouseClass *SidebarPlayerPtr;
  153. };
  154. void Sidebar_Glyphx_Init_Clear(HouseClass *player_ptr = NULL);
  155. void Sidebar_Glyphx_Init_IO(HouseClass *player_ptr = NULL); // Inits button list
  156. bool Sidebar_Glyphx_Abandon_Production(RTTIType type, int factory, HouseClass *player_ptr = NULL);
  157. bool Sidebar_Glyphx_Add(RTTIType type, int ID, HouseClass *player_ptr = NULL, bool via_capture = false);
  158. void Sidebar_Glyphx_Recalc(HouseClass *player_ptr = NULL);
  159. bool Sidebar_Glyphx_Factory_Link(int factory, RTTIType type, int id, HouseClass *player_ptr = NULL);
  160. void Sidebar_Glyphx_AI(HouseClass *player_ptr, KeyNumType & input);
  161. bool Sidebar_Glyphx_Save(Pipe &file, SidebarGlyphxClass *sidebar);
  162. bool Sidebar_Glyphx_Load(Straw &file, SidebarGlyphxClass *sidebar);
  163. void Sidebar_Glyphx_Code_Pointers(SidebarGlyphxClass *sidebar);
  164. void Sidebar_Glyphx_Decode_Pointers(SidebarGlyphxClass *sidebar);
  165. #endif //SIDEBAR_GLYPHX_H