2
0

buildingstate.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/buildingstate.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Byon_g $*
  29. * *
  30. * $Modtime:: 2/07/01 6:00p $*
  31. * *
  32. * $Revision:: 2 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #if defined(_MSC_VER)
  38. #pragma once
  39. #endif
  40. #ifndef BUILDINGSTATES_H
  41. #define BUILDINGSTATES_H
  42. #include "always.h"
  43. /**
  44. ** BuildingStateClass
  45. ** This 'class' encapsulates some functions which work with the enumerated states that buildings can
  46. ** have. These enumerations are used by BuildingGameObj and BuildingAggregateClass...
  47. **
  48. ** WARNING: Don't change these enumerations without checking the BuildingGameObj and BuildingAggregateClass
  49. ** to see what problems you might cause with save-load and their general operation...
  50. */
  51. class BuildingStateClass
  52. {
  53. public:
  54. enum
  55. {
  56. HEALTH100_POWERON = 0,
  57. HEALTH75_POWERON,
  58. HEALTH50_POWERON,
  59. HEALTH25_POWERON,
  60. DESTROYED_POWERON,
  61. HEALTH100_POWEROFF,
  62. HEALTH75_POWEROFF,
  63. HEALTH50_POWEROFF,
  64. HEALTH25_POWEROFF,
  65. DESTROYED_POWEROFF,
  66. STATE_COUNT
  67. };
  68. enum
  69. {
  70. HEALTH_100 = 0,
  71. HEALTH_75,
  72. HEALTH_50,
  73. HEALTH_25,
  74. HEALTH_0,
  75. };
  76. static int Get_Health_State(int building_state);
  77. static int Percentage_To_Health_State(float health);
  78. static bool Is_Power_On(int building_state);
  79. static int Enable_Power(int input_state,bool onoff);
  80. static int Compose_State(int health_state,bool power_onoff);
  81. static const char * Get_State_Name(int state);
  82. };
  83. #endif // BUILDINGSTATES_H