1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

NKAI: object graph improved and optimized

This commit is contained in:
Andrii Danylchenko
2024-03-17 09:34:54 +02:00
parent 3e959f3ad9
commit e66ceff154
9 changed files with 362 additions and 47 deletions

View File

@@ -19,14 +19,19 @@ namespace NKAI
namespace AIPathfinding
{
bool QuestAction::canAct(const AIPathNode * node) const
{
return canAct(node->actor->hero);
}
bool QuestAction::canAct(const CGHeroInstance * hero) const
{
if(questInfo.obj->ID == Obj::BORDER_GATE || questInfo.obj->ID == Obj::BORDERGUARD)
{
return dynamic_cast<const IQuestObject *>(questInfo.obj)->checkQuest(node->actor->hero);
return dynamic_cast<const IQuestObject *>(questInfo.obj)->checkQuest(hero);
}
return questInfo.quest->activeForPlayers.count(node->actor->hero->getOwner())
|| questInfo.quest->checkQuest(node->actor->hero);
return questInfo.quest->activeForPlayers.count(hero->getOwner())
|| questInfo.quest->checkQuest(hero);
}
Goals::TSubgoal QuestAction::decompose(const CGHeroInstance * hero) const