TurnTimerInfo.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * TurnTimerInfo.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. VCMI_LIB_NAMESPACE_BEGIN
  12. struct DLL_LINKAGE TurnTimerInfo
  13. {
  14. int turnTimer = 0; //in ms, counts down when player is making his turn on adventure map
  15. int baseTimer = 0; //in ms, counts down only when turn timer runs out
  16. int battleTimer = 0; //in ms, counts down during battles when creature timer runs out
  17. int unitTimer = 0; //in ms, counts down when player is choosing action in battle
  18. bool accumulatingTurnTimer = false;
  19. bool accumulatingUnitTimer = false;
  20. bool isActive = false; //is being counting down
  21. bool isBattle = false; //indicator for current timer mode
  22. bool isEnabled() const;
  23. bool isBattleEnabled() const;
  24. bool operator == (const TurnTimerInfo & other) const
  25. {
  26. return turnTimer == other.turnTimer &&
  27. baseTimer == other.baseTimer &&
  28. battleTimer == other.battleTimer &&
  29. unitTimer == other.unitTimer &&
  30. accumulatingTurnTimer == other.accumulatingTurnTimer &&
  31. accumulatingUnitTimer == other.accumulatingUnitTimer;
  32. }
  33. template <typename Handler>
  34. void serialize(Handler &h, const int version)
  35. {
  36. h & turnTimer;
  37. h & baseTimer;
  38. h & battleTimer;
  39. h & unitTimer;
  40. h & accumulatingTurnTimer;
  41. h & accumulatingUnitTimer;
  42. h & isActive;
  43. h & isBattle;
  44. }
  45. };
  46. VCMI_LIB_NAMESPACE_END