1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

PreGame: avoid crashing on random map options

Options is still broken, but at least we shouldn't crash there.
This commit is contained in:
ArseniyShestakov
2015-11-25 07:25:44 +03:00
parent 45d183289d
commit 2276af70dc
3 changed files with 12 additions and 5 deletions

View File

@@ -78,6 +78,11 @@ void CMapGenOptions::setPlayerCount(si8 value)
resetPlayersMap();
}
si8 CMapGenOptions::getHumanOnlyPlayerCount() const
{
return humanPlayersCount;
}
si8 CMapGenOptions::getTeamCount() const
{
return teamCount;
@@ -96,7 +101,7 @@ si8 CMapGenOptions::getCompOnlyPlayerCount() const
void CMapGenOptions::setCompOnlyPlayerCount(si8 value)
{
assert(value == RANDOM_SIZE || (value >= 0 && value <= getPlayerCount()));
assert(value == RANDOM_SIZE || (getPlayerCount() == RANDOM_SIZE || (value >= 0 && value <= getPlayerCount())));
compOnlyPlayerCount = value;
if (getPlayerCount() != RANDOM_SIZE && getCompOnlyPlayerCount() != RANDOM_SIZE)