BattleAction.h 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. #ifndef __BATTLEACTION_H__
  2. #define __BATTLEACTION_H__
  3. /*
  4. * BattleAction.h, part of VCMI engine
  5. *
  6. * Authors: listed in file AUTHORS in main folder
  7. *
  8. * License: GNU General Public License v2.0 or later
  9. * Full text of license available in license.txt file, in main folder
  10. *
  11. */
  12. struct BattleAction
  13. {
  14. ui8 side; //who made this action: false - left, true - right player
  15. ui32 stackNumber;//stack ID, -1 left hero, -2 right hero,
  16. enum ActionType
  17. {
  18. NO_ACTION = 0, HERO_SPELL, WALK, DEFEND, RETREAT, SURRENDER, WALK_AND_ATTACK, SHOOT, WAIT, CATAPULT, MONSTER_SPELL, BAD_MORALE, STACK_HEAL
  19. };
  20. ui8 actionType; // 0 = No action; 1 = Hero cast a spell 2 = Walk 3 = Defend 4 = Retreat from the battle
  21. //5 = Surrender 6 = Walk and Attack 7 = Shoot 8 = Wait 9 = Catapult
  22. //10 = Monster casts a spell (i.e. Faerie Dragons) 11 - Bad morale freeze 12 - stacks heals another stack
  23. ui16 destinationTile;
  24. si32 additionalInfo; // e.g. spell number if type is 1 || 10; tile to attack if type is 6
  25. template <typename Handler> void serialize(Handler &h, const int version)
  26. {
  27. h & side & stackNumber & actionType & destinationTile & additionalInfo;
  28. }
  29. };
  30. #endif // __BATTLEACTION_H__