1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00

RMG Options: make "Computer only teams" buttons work as expected

Button "0" should be always enabled and if "Computer only players" set to "0" we should also computer only team count to "0" if it's not random.
This commit is contained in:
ArseniyShestakov
2015-03-16 16:02:52 +03:00
parent 448fbe44e9
commit 323c4e1637

View File

@@ -1698,7 +1698,7 @@ CRandomMapTab::CRandomMapTab()
compOnlyPlayersCntGroup->addCallback([&](int btnId)
{
mapGenOptions.setCompOnlyPlayerCount(btnId);
deactivateButtonsFrom(compOnlyTeamsCntGroup, btnId);
deactivateButtonsFrom(compOnlyTeamsCntGroup, (btnId == 0 ? 1 : btnId));
validateCompOnlyPlayersCnt(btnId);
if(!SEL->isGuest())
updateMapInfo();
@@ -1709,7 +1709,7 @@ CRandomMapTab::CRandomMapTab()
compOnlyTeamsCntGroup->pos.y += 351;
compOnlyTeamsCntGroup->pos.x += BTNS_GROUP_LEFT_MARGIN;
addButtonsWithRandToGroup(compOnlyTeamsCntGroup, numberDefs, 0, 6, NUMBERS_WIDTH, 234, 241);
deactivateButtonsFrom(compOnlyTeamsCntGroup, 0);
deactivateButtonsFrom(compOnlyTeamsCntGroup, 1);
compOnlyTeamsCntGroup->addCallback([&](int btnId)
{
mapGenOptions.setCompOnlyTeamCount(btnId);
@@ -1826,8 +1826,9 @@ void CRandomMapTab::validateCompOnlyPlayersCnt(int compOnlyPlayersCnt)
if(mapGenOptions.getCompOnlyTeamCount() >= compOnlyPlayersCnt)
{
mapGenOptions.setCompOnlyTeamCount(compOnlyPlayersCnt - 1);
compOnlyTeamsCntGroup->setSelected(mapGenOptions.getCompOnlyTeamCount());
int compOnlyTeamCount = compOnlyPlayersCnt == 0 ? 0 : compOnlyPlayersCnt - 1;
mapGenOptions.setCompOnlyTeamCount(compOnlyTeamCount);
compOnlyTeamsCntGroup->setSelected(compOnlyTeamCount);
}
}