1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Nullkiller: stabilisation after refactoring

This commit is contained in:
Andrii Danylchenko 2021-05-16 14:49:39 +03:00 committed by Andrii Danylchenko
parent 1806dd8447
commit 75b8ee74fa
4 changed files with 6 additions and 6 deletions

View File

@ -153,12 +153,11 @@ void Nullkiller::updateAiState()
memory->removeInvisibleObjects(cb.get());
dangerHitMap->updateHitMap();
// TODO: move to hero manager
auto activeHeroes = cb->getHeroesInfo();
vstd::erase_if(activeHeroes, [this](const HeroPtr & hero) -> bool
vstd::erase_if(activeHeroes, [this](const CGHeroInstance * hero) -> bool
{
auto lockedReason = getHeroLockedReason(hero.h);
auto lockedReason = getHeroLockedReason(hero);
return lockedReason == HeroLockedReason::DEFENCE;
});

View File

@ -14,8 +14,6 @@
#include "../../../lib/mapping/CMap.h"
#include "../Engine/Nullkiller.h"
std::shared_ptr<AINodeStorage> AIPathfinder::storage;
AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai)
:cb(cb), ai(ai)
{

View File

@ -18,7 +18,7 @@ class Nullkiller;
class AIPathfinder
{
private:
static std::shared_ptr<AINodeStorage> storage;
std::shared_ptr<AINodeStorage> storage;
CPlayerSpecificInfoCallback * cb;
Nullkiller * ai;

View File

@ -770,6 +770,9 @@ void VCAI::performObjectInteraction(const CGObjectInstance * obj, HeroPtr h)
{
makePossibleUpgrades(h.get());
if(!nullkiller || !h->visitedTown->garrisonHero || !nullkiller->isHeroLocked(h->visitedTown->garrisonHero))
moveCreaturesToHero(h->visitedTown);
if(ai->nullkiller->heroManager->getHeroRole(h) == HeroRole::MAIN && !h->hasSpellbook()
&& cb->getResourceAmount(Res::GOLD) >= GameConstants::SPELLBOOK_GOLD_COST)
{