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

vcmi: allow showing no more than 8 components

In InfoWindow there is no place for more than 8 components.
Better to have more annoying windows than window which cannot be closed

Slider may be better of course, but I cannot do it for now.
This commit is contained in:
Konstantin 2023-03-12 17:18:21 +03:00
parent e764a7255d
commit b4940ee247

View File

@ -1053,11 +1053,17 @@ void CPlayerInterface::showInfoDialog(EInfoWindowMode type, const std::string &t
{
return;
}
std::vector<Component> vect = components; //I do not know currently how to avoid copy here
do
{
std::vector<Component> sender = {vect.begin(), vect.begin() + std::min(vect.size(), static_cast<size_t>(8))};
std::vector<std::shared_ptr<CComponent>> intComps;
for (auto & component : components)
for (auto & component : sender)
intComps.push_back(std::make_shared<CComponent>(component));
showInfoDialog(text,intComps,soundID);
vect.erase(vect.begin(), vect.begin() + std::min(vect.size(), static_cast<size_t>(8)));
}
while(!vect.empty());
}
void CPlayerInterface::showInfoDialog(const std::string & text, std::shared_ptr<CComponent> component)