mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Nullkiller: stabilisation after refactoring
This commit is contained in:
committed by
Andrii Danylchenko
parent
1806dd8447
commit
75b8ee74fa
@ -153,12 +153,11 @@ void Nullkiller::updateAiState()
|
|||||||
memory->removeInvisibleObjects(cb.get());
|
memory->removeInvisibleObjects(cb.get());
|
||||||
dangerHitMap->updateHitMap();
|
dangerHitMap->updateHitMap();
|
||||||
|
|
||||||
// TODO: move to hero manager
|
|
||||||
auto activeHeroes = cb->getHeroesInfo();
|
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;
|
return lockedReason == HeroLockedReason::DEFENCE;
|
||||||
});
|
});
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#include "../../../lib/mapping/CMap.h"
|
#include "../../../lib/mapping/CMap.h"
|
||||||
#include "../Engine/Nullkiller.h"
|
#include "../Engine/Nullkiller.h"
|
||||||
|
|
||||||
std::shared_ptr<AINodeStorage> AIPathfinder::storage;
|
|
||||||
|
|
||||||
AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai)
|
AIPathfinder::AIPathfinder(CPlayerSpecificInfoCallback * cb, Nullkiller * ai)
|
||||||
:cb(cb), ai(ai)
|
:cb(cb), ai(ai)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ class Nullkiller;
|
|||||||
class AIPathfinder
|
class AIPathfinder
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static std::shared_ptr<AINodeStorage> storage;
|
std::shared_ptr<AINodeStorage> storage;
|
||||||
CPlayerSpecificInfoCallback * cb;
|
CPlayerSpecificInfoCallback * cb;
|
||||||
Nullkiller * ai;
|
Nullkiller * ai;
|
||||||
|
|
||||||
|
@ -770,6 +770,9 @@ void VCAI::performObjectInteraction(const CGObjectInstance * obj, HeroPtr h)
|
|||||||
{
|
{
|
||||||
makePossibleUpgrades(h.get());
|
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()
|
if(ai->nullkiller->heroManager->getHeroRole(h) == HeroRole::MAIN && !h->hasSpellbook()
|
||||||
&& cb->getResourceAmount(Res::GOLD) >= GameConstants::SPELLBOOK_GOLD_COST)
|
&& cb->getResourceAmount(Res::GOLD) >= GameConstants::SPELLBOOK_GOLD_COST)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user