DangerHitMapAnalyzer.h 910 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * DangerHitMapAnalyzer.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 "../VCAI.h"
  12. #include "../AIhelper.h"
  13. struct HitMapInfo
  14. {
  15. uint64_t danger;
  16. uint8_t turn;
  17. const CGHeroInstance * hero;
  18. void reset()
  19. {
  20. danger = 0;
  21. turn = 255;
  22. hero = nullptr;
  23. }
  24. };
  25. struct HitMapNode
  26. {
  27. HitMapInfo maximumDanger;
  28. HitMapInfo fastestDanger;
  29. void reset()
  30. {
  31. maximumDanger.reset();
  32. fastestDanger.reset();
  33. }
  34. };
  35. class DangerHitMapAnalyzer
  36. {
  37. private:
  38. boost::multi_array<HitMapNode, 3> hitMap;
  39. std::map<const CGHeroInstance *, int> enemyHeroTreatMAp;
  40. public:
  41. void updateHitMap();
  42. uint64_t enemyCanKillOurHeroesAlongThePath(const AIPath & path) const;
  43. const HitMapNode & getObjectTreat(const CGObjectInstance * town) const;
  44. };