DefendTown.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * ArmyUpgrade.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 "DefendTown.h"
  12. #include "../AIGateway.h"
  13. #include "../Engine/Nullkiller.h"
  14. #include "../AIUtility.h"
  15. namespace NKAI
  16. {
  17. using namespace Goals;
  18. DefendTown::DefendTown(const CGTownInstance * town, const HitMapInfo & treat, const AIPath & defencePath, bool isCounterAttack)
  19. : CGoal(Goals::DEFEND_TOWN), treat(treat), defenceArmyStrength(defencePath.getHeroStrength()), turn(defencePath.turn()), counterattack(isCounterAttack)
  20. {
  21. settown(town);
  22. sethero(defencePath.targetHero);
  23. }
  24. DefendTown::DefendTown(const CGTownInstance * town, const HitMapInfo & treat, const CGHeroInstance * defender)
  25. : CGoal(Goals::DEFEND_TOWN), treat(treat), defenceArmyStrength(defender->getTotalStrength()), turn(0)
  26. {
  27. settown(town);
  28. sethero(defender);
  29. }
  30. bool DefendTown::operator==(const DefendTown & other) const
  31. {
  32. return false;
  33. }
  34. std::string DefendTown::toString() const
  35. {
  36. return "Defend town " + town->getObjectName();
  37. }
  38. }