SideInBattle.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * SideInBattle.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 "../GameConstants.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGHeroInstance;
  14. class CArmedInstance;
  15. struct DLL_LINKAGE SideInBattle
  16. {
  17. PlayerColor color = PlayerColor::CANNOT_DETERMINE;
  18. const CGHeroInstance * hero = nullptr; //may be NULL if army is not commanded by hero
  19. const CArmedInstance * armyObject = nullptr; //adv. map object with army that participates in battle; may be same as hero
  20. uint32_t castSpellsCount = 0; //how many spells each side has been cast this turn
  21. std::vector<SpellID> usedSpellsHistory; //every time hero casts spell, it's inserted here -> eagle eye skill
  22. int32_t enchanterCounter = 0; //tends to pass through 0, so sign is needed
  23. void init(const CGHeroInstance * Hero, const CArmedInstance * Army);
  24. template <typename Handler> void serialize(Handler &h)
  25. {
  26. h & color;
  27. h & hero;
  28. h & armyObject;
  29. h & castSpellsCount;
  30. h & usedSpellsHistory;
  31. h & enchanterCounter;
  32. }
  33. };
  34. VCMI_LIB_NAMESPACE_END