CaveSystem.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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: CaveSystem.h /////////////////////////////////////////////////////////////////////////////////
  24. // Author: Graham Smallwood July 2002
  25. // Desc: System responsible for keeping track of the connectedness of all cave systems on the map
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef CAVE_SYSTEM_H
  29. #define CAVE_SYSTEM_H
  30. class Object;
  31. class TunnelTracker; // The player owns one such object for his Tunnels, so instead of duplicating
  32. // so much code, this SubSystem will manage all of the Cave systems.
  33. #include "Common/Snapshot.h"
  34. #include "Common/SubsystemInterface.h"
  35. /**
  36. System responsible for Crates as code objects - ini, new/delete etc
  37. */
  38. class CaveSystem : public SubsystemInterface,
  39. public Snapshot
  40. {
  41. public:
  42. CaveSystem();
  43. ~CaveSystem();
  44. void init();
  45. void reset();
  46. void update();
  47. Bool canSwitchIndexToIndex( Int oldIndex, Int newIndex ); // If either Index has guys in it, no, you can't
  48. void registerNewCave( Int theIndex ); // All Caves are born with a default index, which could be new
  49. void unregisterCave( Int theIndex ); //
  50. TunnelTracker *getTunnelTrackerForCaveIndex( Int theIndex );
  51. protected:
  52. // snapshot methods
  53. virtual void crc( Xfer *xfer ) { }
  54. virtual void xfer( Xfer *xfer );
  55. virtual void loadPostProcess( void ) { }
  56. private:
  57. std::vector<TunnelTracker*> m_tunnelTrackerVector;// A vector of pointers where the indexes are known by
  58. // others, so it can have NULLs in it to keep position. I've been advised against a map, so don't be a jerk
  59. // and use spot 20 first.
  60. };
  61. extern CaveSystem *TheCaveSystem;
  62. #endif