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

check availability only of town creatures

QRD shows only town creatures ignoring Summoning Portal
This commit is contained in:
Andrey Filipenkov 2022-09-18 12:38:50 +03:00
parent a0832c39f9
commit 90d355dd05

View File

@ -842,7 +842,11 @@ void CCastleBuildings::enterDwelling(int level)
void CCastleBuildings::enterToTheQuickRecruitmentWindow()
{
const auto hasSomeoneToRecruit = std::any_of(town->creatures.cbegin(), town->creatures.cend(),
const auto beginIt = town->creatures.cbegin();
const auto afterLastIt = town->creatures.size() > GameConstants::CREATURES_PER_TOWN
? std::next(beginIt, GameConstants::CREATURES_PER_TOWN)
: town->creatures.cend();
const auto hasSomeoneToRecruit = std::any_of(beginIt, afterLastIt,
[](const auto & creatureInfo) { return creatureInfo.first > 0; });
if(hasSomeoneToRecruit)
GH.pushIntT<QuickRecruitmentWindow>(town, pos);