1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Remove hardcoded checks for town portal from AI code

This commit is contained in:
Ivan Savenko
2025-07-11 18:03:18 +03:00
parent f51c7c5c28
commit b1aff17e82
10 changed files with 82 additions and 54 deletions

View File

@@ -19,5 +19,5 @@ Goals::TSubgoal TownPortalAction::whatToDo(const HeroPtr & hero) const
{
const CGTownInstance * targetTown = target; // const pointer is not allowed in settown
return Goals::sptr(Goals::AdventureSpellCast(hero, SpellID::TOWN_PORTAL).settown(targetTown).settile(targetTown->visitablePos()));
return Goals::sptr(Goals::AdventureSpellCast(hero, spellToUse).settown(targetTown).settile(targetTown->visitablePos()));
}

View File

@@ -20,10 +20,12 @@ namespace AIPathfinding
{
private:
const CGTownInstance * target;
SpellID spellToUse;
public:
TownPortalAction(const CGTownInstance * target)
TownPortalAction(const CGTownInstance * target, SpellID spellToUse)
:target(target)
,spellToUse(spellToUse)
{
}