1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

show message instead of the Quick Recruit dialog when there're no creatures in town

This commit is contained in:
Andrey Filipenkov 2022-09-17 15:41:56 +03:00
parent e85f8a56bb
commit a0832c39f9

View File

@ -842,7 +842,12 @@ void CCastleBuildings::enterDwelling(int level)
void CCastleBuildings::enterToTheQuickRecruitmentWindow()
{
GH.pushIntT<QuickRecruitmentWindow>(town, pos);
const auto hasSomeoneToRecruit = std::any_of(town->creatures.cbegin(), town->creatures.cend(),
[](const auto & creatureInfo) { return creatureInfo.first > 0; });
if(hasSomeoneToRecruit)
GH.pushIntT<QuickRecruitmentWindow>(town, pos);
else
CInfoWindow::showInfoDialog("There are no creatures to recruit", {});
}
void CCastleBuildings::enterFountain(const BuildingID & building, BuildingSubID::EBuildingSubID subID, BuildingID::EBuildingID upgrades)