DismissHero.cpp 694 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * DismissHero.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 "DismissHero.h"
  12. #include "../AIGateway.h"
  13. namespace NKAI
  14. {
  15. using namespace Goals;
  16. bool DismissHero::operator==(const DismissHero & other) const
  17. {
  18. return hero == other.hero;
  19. }
  20. void DismissHero::accept(AIGateway * ai)
  21. {
  22. if(!hero)
  23. throw cannotFulfillGoalException("Invalid hero!");
  24. cb->dismissHero(hero);
  25. throw goalFulfilledException(sptr(*this));
  26. }
  27. std::string DismissHero::toString() const
  28. {
  29. return "DismissHero " + heroName;
  30. }
  31. }