1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

fix if only one line

This commit is contained in:
Laserlicht
2024-06-29 20:09:26 +02:00
parent 301da0b75a
commit da83f5dc3b

View File

@@ -503,23 +503,7 @@ void OptionsTab::SelectionWindow::recreate()
elementsPerLine = allowedBonus.size();
else
{
// try to make squarish
if(type == SelType::TOWN)
elementsPerLine = std::min((int)allowedFactions.size(), MAX_ELEM_PER_LINES);
if(type == SelType::HERO)
{
int count = 0;
for(auto & elem : allowedHeroes)
{
const CHero * type = elem.toHeroType();
if(type->heroClass->faction == selectedFaction)
{
count++;
}
}
elementsPerLine = std::min(count, MAX_ELEM_PER_LINES);
}
elementsPerLine = MAX_ELEM_PER_LINES;
amountLines = calcLines((type > SelType::TOWN) ? selectedFaction : FactionID::RANDOM);
}