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

Merge pull request #6078 from Laserlicht/fix_underground_toggle

fix underground toggle
This commit is contained in:
Ivan Savenko
2025-08-29 21:43:58 +03:00
committed by GitHub

View File

@@ -331,12 +331,14 @@ void RandomMapTab::setMapGenOptions(std::shared_ptr<CMapGenOptions> opts)
}
if(auto w = widget<CToggleButton>("buttonTwoLevels"))
{
int3 size( opts->getWidth(), opts->getWidth(), 2);
bool undergoundAllowed = !mapGenOptions->getMapTemplate() || mapGenOptions->getMapTemplate()->matchesSize(size);
int possibleLevelCount = 2;
if(mapGenOptions->getMapTemplate())
{
auto sizes = mapGenOptions->getMapTemplate()->getMapSizes();
possibleLevelCount = sizes.second.z - sizes.first.z + 1;
}
w->setSelected(opts->getLevels() == 2); // TODO: multilevel support
w->block(!undergoundAllowed);
w->block(possibleLevelCount < 2);
}
if(auto w = widget<CToggleGroup>("groupMaxPlayers"))
{