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)
{
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));
validateCompOnlyPlayersCnt(btnId);
updateMapInfoByHost();

View File

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