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:
parent
1806dd8447
commit
75b8ee74fa
@ -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;
|
||||
});
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ class Nullkiller;
|
||||
class AIPathfinder
|
||||
{
|
||||
private:
|
||||
static std::shared_ptr<AINodeStorage> storage;
|
||||
std::shared_ptr<AINodeStorage> storage;
|
||||
CPlayerSpecificInfoCallback * cb;
|
||||
Nullkiller * ai;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user