TurnTimerInfo.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. int remainingMovementPointsPercent = 0; //displayed as bar
  23. bool isTurnStart = false; //game is waiting for the player starting his turn
  24. bool isTurnEnded = false; //player has ended his turn
  25. bool isEnabled() const;
  26. bool isBattleEnabled() const;
  27. void subtractTimer(int timeMs);
  28. int valueMs() const;
  29. bool operator == (const TurnTimerInfo & other) const;
  30. template <typename Handler>
  31. void serialize(Handler &h)
  32. {
  33. h & turnTimer;
  34. h & baseTimer;
  35. h & battleTimer;
  36. h & unitTimer;
  37. h & accumulatingTurnTimer;
  38. h & accumulatingUnitTimer;
  39. h & isActive;
  40. h & isBattle;
  41. if(h.hasFeature(Handler::Version::TIMER_MOVEMENT_POINTS))
  42. {
  43. h & remainingMovementPointsPercent;
  44. h & isTurnStart;
  45. h & isTurnEnded;
  46. }
  47. }
  48. };
  49. VCMI_LIB_NAMESPACE_END