BattleAttackInfo.cpp 846 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * BattleAttackInfo.cpp, 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. #include "StdInc.h"
  11. #include "BattleAttackInfo.h"
  12. #include "CUnitState.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. BattleAttackInfo::BattleAttackInfo(const battle::Unit * Attacker, const battle::Unit * Defender, int chargeDistance, bool Shooting)
  15. : attacker(Attacker),
  16. defender(Defender),
  17. shooting(Shooting),
  18. attackerPos(BattleHex::INVALID),
  19. defenderPos(BattleHex::INVALID),
  20. chargeDistance(chargeDistance)
  21. {}
  22. BattleAttackInfo BattleAttackInfo::reverse() const
  23. {
  24. BattleAttackInfo ret(defender, attacker, 0, false);
  25. ret.defenderPos = attackerPos;
  26. ret.attackerPos = defenderPos;
  27. return ret;
  28. }
  29. VCMI_LIB_NAMESPACE_END