1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

Fixed some obvious bugs with random map options.

This commit is contained in:
DjWarmonger 2014-05-22 20:50:24 +02:00
parent 1e1dce20a8
commit aead8da54f

View File

@ -194,17 +194,17 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
auto possiblePlayers = mapTemplate->getPlayers().getNumbers();
possiblePlayers.erase(possiblePlayers.begin(), possiblePlayers.lower_bound(countHumanPlayers()));
assert(!possiblePlayers.empty());
playerCount = *std::next(possiblePlayers.begin(), rand.nextInt(8));
playerCount = rand.nextInt(possiblePlayers.size());
updatePlayers();
}
if(teamCount == RANDOM_SIZE)
{
teamCount = rand.nextInt(8);
teamCount = rand.nextInt(playerCount - 1);
}
if(compOnlyPlayerCount == RANDOM_SIZE)
{
auto possiblePlayers = mapTemplate->getCpuPlayers().getNumbers();
compOnlyPlayerCount = *std::next(possiblePlayers.begin(), rand.nextInt(8));
compOnlyPlayerCount = rand.nextInt(possiblePlayers.size());
updateCompOnlyPlayers();
}
if(compOnlyTeamCount == RANDOM_SIZE)