1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
nordsoft 2022-11-18 04:05:35 +04:00
parent 0b7edd471c
commit 625c18a889
2 changed files with 5 additions and 1 deletions

View File

@ -107,6 +107,10 @@ RandomMapTab::RandomMapTab()
groupCompOnlyPlayers->addCallback([&](int btnId) groupCompOnlyPlayers->addCallback([&](int btnId)
{ {
mapGenOptions->setCompOnlyPlayerCount(btnId); mapGenOptions->setCompOnlyPlayerCount(btnId);
// deactive some MaxPlayers buttons to prevent total number of players exceeds PlayerColor::PLAYER_LIMIT_I
deactivateButtonsFrom(groupMaxPlayers.get(), PlayerColor::PLAYER_LIMIT_I - btnId + 1);
deactivateButtonsFrom(groupCompOnlyTeams.get(), (btnId == 0 ? 1 : btnId)); deactivateButtonsFrom(groupCompOnlyTeams.get(), (btnId == 0 ? 1 : btnId));
validateCompOnlyPlayersCnt(btnId); validateCompOnlyPlayersCnt(btnId);
updateMapInfoByHost(); updateMapInfoByHost();

View File

@ -70,7 +70,7 @@ void CMapGenOptions::setPlayerCount(si8 value)
assert((value >= 1 && value <= PlayerColor::PLAYER_LIMIT_I) || value == RANDOM_SIZE); assert((value >= 1 && value <= PlayerColor::PLAYER_LIMIT_I) || value == RANDOM_SIZE);
playerCount = value; playerCount = value;
auto possibleCompPlayersCount = value; auto possibleCompPlayersCount = PlayerColor::PLAYER_LIMIT_I - value;
if (compOnlyPlayerCount > possibleCompPlayersCount) if (compOnlyPlayerCount > possibleCompPlayersCount)
setCompOnlyPlayerCount(possibleCompPlayersCount); setCompOnlyPlayerCount(possibleCompPlayersCount);