SideInBattle.h 1.3 KB

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