ResourceGatheringManager.h 2.9 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: ResourceGatheringManager.h ///////////////////////////////////////////////////////////
  24. // The part of a Player's brain that keeps track of all Resource type Objects and makes
  25. // gathering type decisions based on them.
  26. // Author: Graham Smallwood, January, 2002
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////
  28. #pragma once
  29. #ifndef RESOURCE_GATHER_MANAGER_H
  30. #define RESOURCE_GATHER_MANAGER_H
  31. #include "Common/GameType.h"
  32. #include "Common/Snapshot.h"
  33. class Object;
  34. // ------------------------------------------------------------------------------------------------
  35. class ResourceGatheringManager : public MemoryPoolObject,
  36. public Snapshot
  37. {
  38. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ResourceGatheringManager, "ResourceGatheringManager" );
  39. public:
  40. ResourceGatheringManager();
  41. Object *findBestSupplyWarehouse( Object *queryObject ); ///< What Warehouse should this truck go to?
  42. Object *findBestSupplyCenter( Object *queryObject ); ///< What Center should this truck return to?
  43. void addSupplyCenter( Object *newCenter ); ///< I captured or built a Supply Center, so record it
  44. void removeSupplyCenter( Object *oldCenter ); ///< Lost a supply center
  45. void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is starrt of game recording
  46. void removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replinish has run out of Supply
  47. protected:
  48. // snapshot methods
  49. virtual void crc( Xfer *xfer );
  50. virtual void xfer( Xfer *xfer );
  51. virtual void loadPostProcess( void );
  52. private:
  53. /// @todo Make sure the allocator for std::list<> is a good one. Otherwise override it.
  54. typedef std::list<ObjectID> objectIDList;
  55. typedef std::list<ObjectID>::iterator objectIDListIterator;
  56. objectIDList m_supplyWarehouses;
  57. objectIDList m_supplyCenters;
  58. };
  59. #endif