mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Fix 2160 dismissing a VIP hero
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../BattleState.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CMap.h"
|
||||
#include "CGTownInstance.h"
|
||||
|
||||
///helpers
|
||||
@ -1454,3 +1455,27 @@ bool CGHeroInstance::hasVisions(const CGObjectInstance * target, const int subty
|
||||
|
||||
return (distance < visionsRange) && (target->pos.z == pos.z);
|
||||
}
|
||||
|
||||
bool CGHeroInstance::isMissionCritical() const
|
||||
{
|
||||
for(const TriggeredEvent & event : IObjectInterface::cb->getMapHeader()->triggeredEvents)
|
||||
{
|
||||
if(event.trigger.test([&](const EventCondition & condition)
|
||||
{
|
||||
if (condition.condition == EventCondition::CONTROL && condition.object)
|
||||
{
|
||||
auto hero = dynamic_cast<const CGHeroInstance*>(condition.object);
|
||||
return (hero != this);
|
||||
}
|
||||
else if(condition.condition == EventCondition::IS_HUMAN)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user