LocomotorSet.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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: LocomotorSet.h /////////////////////////////////////////////////////////////////////////////////
  24. // Author: Steven Johnson, Feb 2002
  25. // Desc: Locomotor Descriptions
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __LocomotorSet_H_
  29. #define __LocomotorSet_H_
  30. // no, please do NOT include this.
  31. //#include "GameLogic/Locomotor.h"
  32. #include "Common/GameCommon.h"
  33. #include "Common/STLTypedefs.h"
  34. #include "Common/Snapshot.h"
  35. class Locomotor;
  36. class LocomotorTemplate;
  37. //-------------------------------------------------------------------------------------------------
  38. //
  39. // Note: these values are saved in save files, so you MUST NOT REMOVE OR CHANGE
  40. // existing values!
  41. //
  42. enum LocomotorSurfaceType
  43. {
  44. LOCOMOTORSURFACE_GROUND = (1 << 0), ///< clear, unobstructed ground
  45. LOCOMOTORSURFACE_WATER = (1 << 1), ///< water area
  46. LOCOMOTORSURFACE_CLIFF = (1 << 2), ///< steep altitude change
  47. LOCOMOTORSURFACE_AIR = (1 << 3), ///< airborne
  48. LOCOMOTORSURFACE_RUBBLE = (1 << 4) ///< building rubble
  49. };
  50. typedef Int LocomotorSurfaceTypeMask;
  51. const LocomotorSurfaceTypeMask NO_SURFACES = (LocomotorSurfaceTypeMask)0x0000;
  52. const LocomotorSurfaceTypeMask ALL_SURFACES = (LocomotorSurfaceTypeMask)0xffff;
  53. #ifdef DEFINE_SURFACECATEGORY_NAMES
  54. static const char *TheLocomotorSurfaceTypeNames[] =
  55. {
  56. "GROUND",
  57. "WATER",
  58. "CLIFF",
  59. "AIR",
  60. "RUBBLE",
  61. NULL
  62. };
  63. #endif
  64. //-------------------------------------------------------------------------------------------------
  65. typedef std::vector< Locomotor* > LocomotorVector;
  66. //-------------------------------------------------------------------------------------------------
  67. class LocomotorSet : public Snapshot
  68. {
  69. private:
  70. LocomotorVector m_locomotors;
  71. LocomotorSurfaceTypeMask m_validLocomotorSurfaces;
  72. Bool m_downhillOnly;
  73. LocomotorSet(const LocomotorSet& that);
  74. LocomotorSet& operator=(const LocomotorSet& that);
  75. protected:
  76. // snapshot methods
  77. virtual void crc( Xfer *xfer );
  78. virtual void xfer( Xfer *xfer );
  79. virtual void loadPostProcess( void );
  80. public:
  81. LocomotorSet();
  82. ~LocomotorSet();
  83. void clear();
  84. void addLocomotor(const LocomotorTemplate* lt);
  85. Locomotor* findLocomotor(LocomotorSurfaceTypeMask t);
  86. void xferSelfAndCurLocoPtr(Xfer *xfer, Locomotor** loco);
  87. inline LocomotorSurfaceTypeMask getValidSurfaces() const { return m_validLocomotorSurfaces; }
  88. inline Bool isDownhillOnly( void ) const { return m_downhillOnly; };
  89. };
  90. #endif