TurnInfo.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * TurnInfo.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 "../bonuses/Bonus.h"
  12. #include "../GameConstants.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CGHeroInstance;
  15. struct DLL_LINKAGE TurnInfo
  16. {
  17. /// This is certainly not the best design ever and certainly can be improved
  18. /// Unfortunately for pathfinder that do hundreds of thousands calls onus system add too big overhead
  19. struct BonusCache {
  20. std::set<TerrainId> noTerrainPenalty;
  21. bool freeShipBoarding;
  22. bool flyingMovement;
  23. int flyingMovementVal;
  24. bool waterWalking;
  25. int waterWalkingVal;
  26. int pathfindingVal;
  27. BonusCache(const TConstBonusListPtr & bonusList);
  28. };
  29. std::unique_ptr<BonusCache> bonusCache;
  30. const CGHeroInstance * hero;
  31. mutable TConstBonusListPtr bonuses;
  32. mutable int maxMovePointsLand;
  33. mutable int maxMovePointsWater;
  34. TerrainId nativeTerrain;
  35. int turn;
  36. TurnInfo(const CGHeroInstance * Hero, const int Turn = 0);
  37. bool isLayerAvailable(const EPathfindingLayer & layer) const;
  38. bool hasBonusOfType(const BonusType type) const;
  39. bool hasBonusOfType(const BonusType type, const BonusSubtypeID subtype) const;
  40. int valOfBonuses(const BonusType type) const;
  41. int valOfBonuses(const BonusType type, const BonusSubtypeID subtype) const;
  42. void updateHeroBonuses(BonusType type) const;
  43. int getMaxMovePoints(const EPathfindingLayer & layer) const;
  44. };
  45. VCMI_LIB_NAMESPACE_END