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

vcmi: no open-code NO_APPROPRIATE_TARGET

This commit is contained in:
Konstantin 2023-03-22 12:04:28 +03:00
parent e2596accc7
commit e40b9c849d
2 changed files with 2 additions and 13 deletions

View File

@ -76,12 +76,7 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m) const
}
if(!(targetExists && targetToSacrificeExists))
{
MetaString text;
text.addTxt(MetaString::GENERAL_TXT, 185);
problem.add(std::move(text), Problem::NORMAL);
return false;
}
return m->adaptProblem(ESpellCastProblem::NO_APPROPRIATE_TARGET, problem);
return true;
}

View File

@ -46,13 +46,7 @@ bool UnitEffect::applicable(Problem & problem, const Mechanics * m) const
auto targets = m->battle()->battleGetUnitsIf(mainFilter);
vstd::erase_if(targets, predicate);
if(targets.empty())
{
MetaString text;
text.addTxt(MetaString::GENERAL_TXT, 185);
problem.add(std::move(text), Problem::NORMAL);
return false;
}
return m->adaptProblem(ESpellCastProblem::NO_APPROPRIATE_TARGET, problem);
return true;
}