1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fixed check for free slots when recruiting in towns

This commit is contained in:
Ivan Savenko
2023-11-28 16:25:11 +02:00
parent 9277761da5
commit ea8995e901
2 changed files with 3 additions and 3 deletions

View File

@@ -901,7 +901,7 @@ void CCastleBuildings::enterDwelling(int level)
{ {
LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level); LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
}; };
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, nullptr, -87); GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town->getUpperArmy(), recruitCb, nullptr, -87);
} }
void CCastleBuildings::enterToTheQuickRecruitmentWindow() void CCastleBuildings::enterToTheQuickRecruitmentWindow()
@@ -1110,7 +1110,7 @@ void CCreaInfo::clickPressed(const Point & cursorPosition)
{ {
LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level); LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
}; };
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, nullptr, offset); GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town->getUpperArmy(), recruitCb, nullptr, offset);
} }
std::string CCreaInfo::genGrowthText() std::string CCreaInfo::genGrowthText()

View File

@@ -159,7 +159,7 @@ void CRecruitmentWindow::buy()
else else
{ {
std::string txt; std::string txt;
if(dst->ID == Obj::HERO) if(dwelling->ID != Obj::TOWN)
{ {
txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them. txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them.
boost::algorithm::replace_first(txt, "%s", slider->getValue() > 1 ? CGI->creh->objects[crid]->getNamePluralTranslated() : CGI->creh->objects[crid]->getNameSingularTranslated()); boost::algorithm::replace_first(txt, "%s", slider->getValue() > 1 ? CGI->creh->objects[crid]->getNamePluralTranslated() : CGI->creh->objects[crid]->getNameSingularTranslated());