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

Something that compiles, but crashes when launching RMG map.

This commit is contained in:
DjWarmonger
2014-05-22 19:25:17 +02:00
parent 88f962d6d5
commit 1e1dce20a8
8 changed files with 417 additions and 1793 deletions

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 = *RandomGeneratorUtil::nextItem(possiblePlayers, rand);
playerCount = *std::next(possiblePlayers.begin(), rand.nextInt(8));
updatePlayers();
}
if(teamCount == RANDOM_SIZE)
{
teamCount = rand.nextInt(playerCount - 1);
teamCount = rand.nextInt(8);
}
if(compOnlyPlayerCount == RANDOM_SIZE)
{
auto possiblePlayers = mapTemplate->getCpuPlayers().getNumbers();
compOnlyPlayerCount = *RandomGeneratorUtil::nextItem(possiblePlayers, rand);
compOnlyPlayerCount = *std::next(possiblePlayers.begin(), rand.nextInt(8));
updateCompOnlyPlayers();
}
if(compOnlyTeamCount == RANDOM_SIZE)
@@ -220,11 +220,11 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
if(waterContent == EWaterContent::RANDOM)
{
waterContent = static_cast<EWaterContent::EWaterContent>(rand.nextInt(2));
waterContent = static_cast<EWaterContent::EWaterContent>(rand.nextInt(EWaterContent::TOTAL_COUNT));
}
if(monsterStrength == EMonsterStrength::RANDOM)
{
monsterStrength = static_cast<EMonsterStrength::EMonsterStrength>(rand.nextInt(2));
monsterStrength = static_cast<EMonsterStrength::EMonsterStrength>(rand.nextInt(EMonsterStrength::TOTAL_COUNT));
}
}