Explorar o código

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

Andrey Filipenkov %!s(int64=3) %!d(string=hai) anos
pai
achega
a0832c39f9
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      client/windows/CCastleInterface.cpp

+ 6 - 1
client/windows/CCastleInterface.cpp

@@ -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)