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

Avoid costly std vector construction

This commit is contained in:
Ivan Savenko 2023-11-18 19:42:02 +02:00
parent 9b8145f522
commit 3ac80e1f09

View File

@ -357,7 +357,7 @@ const battle::Unit * CBattleInfoCallback::battleGetUnitByPos(BattleHex pos, bool
auto ret = battleGetUnitsIf([=](const battle::Unit * unit)
{
return !unit->isGhost()
&& vstd::contains(battle::Unit::getHexes(unit->getPosition(), unit->doubleWide(), unit->unitSide()), pos)
&& unit->coversPos(pos)
&& (!onlyAlive || unit->alive());
});