mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +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:
@ -1875,9 +1875,9 @@ void CRandomMapTab::updateMapInfo()
|
||||
|
||||
// Generate player information
|
||||
mapInfo->mapHeader->players.clear();
|
||||
int playersToGen = (mapGenOptions.getPlayerCount() == CMapGenOptions::RANDOM_SIZE
|
||||
|| mapGenOptions.getCompOnlyPlayerCount() == CMapGenOptions::RANDOM_SIZE)
|
||||
? 8 : mapGenOptions.getPlayerCount() + mapGenOptions.getCompOnlyPlayerCount();
|
||||
int playersToGen = PlayerColor::PLAYER_LIMIT_I;
|
||||
if(mapGenOptions.getPlayerCount() != CMapGenOptions::RANDOM_SIZE)
|
||||
playersToGen = mapGenOptions.getPlayerCount();
|
||||
mapInfo->mapHeader->howManyTeams = playersToGen;
|
||||
|
||||
for(int i = 0; i < playersToGen; ++i)
|
||||
@ -1885,7 +1885,7 @@ void CRandomMapTab::updateMapInfo()
|
||||
PlayerInfo player;
|
||||
player.isFactionRandom = true;
|
||||
player.canComputerPlay = true;
|
||||
if(i >= mapGenOptions.getPlayerCount() && mapGenOptions.getPlayerCount() != CMapGenOptions::RANDOM_SIZE)
|
||||
if(i >= mapGenOptions.getHumanOnlyPlayerCount())
|
||||
{
|
||||
player.canHumanPlay = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user