mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix dismissing heroes on map with "Capture town" victory condition
This commit is contained in:
parent
95dd4b3ffb
commit
397c4c7595
@ -1718,22 +1718,25 @@ bool CGHeroInstance::isMissionCritical() const
|
|||||||
{
|
{
|
||||||
for(const TriggeredEvent & event : IObjectInterface::cb->getMapHeader()->triggeredEvents)
|
for(const TriggeredEvent & event : IObjectInterface::cb->getMapHeader()->triggeredEvents)
|
||||||
{
|
{
|
||||||
if(event.trigger.test([&](const EventCondition & condition)
|
if (event.effect.type != EventEffect::DEFEAT)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
auto const & testFunctor = [&](const EventCondition & condition)
|
||||||
{
|
{
|
||||||
if ((condition.condition == EventCondition::CONTROL || condition.condition == EventCondition::HAVE_0) && condition.object)
|
if ((condition.condition == EventCondition::CONTROL || condition.condition == EventCondition::HAVE_0) && condition.object)
|
||||||
{
|
{
|
||||||
const auto * hero = dynamic_cast<const CGHeroInstance *>(condition.object);
|
const auto * hero = dynamic_cast<const CGHeroInstance *>(condition.object);
|
||||||
return (hero != this);
|
return (hero != this);
|
||||||
}
|
}
|
||||||
else if(condition.condition == EventCondition::IS_HUMAN)
|
|
||||||
{
|
if(condition.condition == EventCondition::IS_HUMAN)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}))
|
};
|
||||||
{
|
|
||||||
|
if(event.trigger.test(testFunctor))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user