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

NKAI: allow multiple tasks to be executed from one calculation

This commit is contained in:
Andrii Danylchenko
2024-04-14 15:23:44 +03:00
parent 9390825ee7
commit ed76d8a652
33 changed files with 559 additions and 219 deletions

View File

@@ -18,12 +18,12 @@ using namespace Goals;
bool AdventureSpellCast::operator==(const AdventureSpellCast & other) const
{
return hero.h == other.hero.h;
return hero == other.hero;
}
void AdventureSpellCast::accept(AIGateway * ai)
{
if(!hero.validAndSet())
if(!hero)
throw cannotFulfillGoalException("Invalid hero!");
auto spell = getSpell();
@@ -56,7 +56,7 @@ void AdventureSpellCast::accept(AIGateway * ai)
auto wait = cb->waitTillRealize;
cb->waitTillRealize = true;
cb->castSpell(hero.h, spellID, tile);
cb->castSpell(hero, spellID, tile);
if(town && spellID == SpellID::TOWN_PORTAL)
{