1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

fix underground toggle

This commit is contained in:
Laserlicht
2025-08-29 19:46:41 +02:00
parent 6c08c23fbf
commit 4fc45a44cc

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"))
{