From aead8da54fabf9a93b52660cdb7b48d14c3fdc9f Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Thu, 22 May 2014 20:50:24 +0200 Subject: [PATCH] Fixed some obvious bugs with random map options. --- lib/rmg/CMapGenOptions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rmg/CMapGenOptions.cpp b/lib/rmg/CMapGenOptions.cpp index b2835020d..ec127e378 100644 --- a/lib/rmg/CMapGenOptions.cpp +++ b/lib/rmg/CMapGenOptions.cpp @@ -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)