NodeStorage.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * NodeStorage.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "INodeStorage.h"
  12. #include "CGPathNode.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class DLL_LINKAGE NodeStorage : public INodeStorage
  15. {
  16. private:
  17. CPathsInfo & out;
  18. STRONG_INLINE
  19. void resetTile(const int3 & tile, const EPathfindingLayer & layer, EPathAccessibility accessibility);
  20. public:
  21. NodeStorage(CPathsInfo & pathsInfo, const CGHeroInstance * hero);
  22. STRONG_INLINE
  23. CGPathNode * getNode(const int3 & coord, const EPathfindingLayer layer)
  24. {
  25. return out.getNode(coord, layer);
  26. }
  27. void initialize(const PathfinderOptions & options, const IGameInfoCallback & gameInfo) override;
  28. virtual ~NodeStorage() = default;
  29. std::vector<CGPathNode *> getInitialNodes() override;
  30. virtual void calculateNeighbours(
  31. std::vector<CGPathNode *> & result,
  32. const PathNodeInfo & source,
  33. EPathfindingLayer layer,
  34. const PathfinderConfig * pathfinderConfig,
  35. const CPathfinderHelper * pathfinderHelper) override;
  36. virtual std::vector<CGPathNode *> calculateTeleportations(
  37. const PathNodeInfo & source,
  38. const PathfinderConfig * pathfinderConfig,
  39. const CPathfinderHelper * pathfinderHelper) override;
  40. void commit(CDestinationNodeInfo & destination, const PathNodeInfo & source) override;
  41. };
  42. VCMI_LIB_NAMESPACE_END