TownPortalAction.cpp 749 B

123456789101112131415161718192021222324
  1. /*
  2. * TownPortalAction.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 "../../Goals/AdventureSpellCast.h"
  12. #include "../../../../lib/mapping/CMap.h"
  13. #include "../../../../lib/mapObjects/MapObjects.h"
  14. #include "TownPortalAction.h"
  15. using namespace AIPathfinding;
  16. Goals::TSubgoal TownPortalAction::whatToDo(const CGHeroInstance * hero) const
  17. {
  18. const CGTownInstance * targetTown = target; // const pointer is not allowed in settown
  19. return Goals::sptr(Goals::AdventureSpellCast(hero, SpellID::TOWN_PORTAL).settown(targetTown).settile(targetTown->visitablePos()));
  20. }