mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
- Implemented some really nice gravity-based algorithm
- Fixed zones placed outside the map (causing various bugs)
This commit is contained in:
@@ -65,7 +65,7 @@ si8 CMapGenOptions::getPlayerCount() const
|
||||
|
||||
void CMapGenOptions::setPlayerCount(si8 value)
|
||||
{
|
||||
assert((value >= 1 && value <= PlayerColor::PLAYER_LIMIT_I) || value == RANDOM_SIZE);
|
||||
assert((value >= 2 && value <= PlayerColor::PLAYER_LIMIT_I) || value == RANDOM_SIZE);
|
||||
playerCount = value;
|
||||
resetPlayersMap();
|
||||
}
|
||||
@@ -200,6 +200,8 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
|
||||
if(teamCount == RANDOM_SIZE)
|
||||
{
|
||||
teamCount = rand.nextInt(playerCount - 1);
|
||||
if (teamCount == 1)
|
||||
teamCount = 0;
|
||||
}
|
||||
if(compOnlyPlayerCount == RANDOM_SIZE)
|
||||
{
|
||||
@@ -212,12 +214,6 @@ void CMapGenOptions::finalize(CRandomGenerator & rand)
|
||||
compOnlyTeamCount = rand.nextInt(std::max(compOnlyPlayerCount - 1, 0));
|
||||
}
|
||||
|
||||
// 1 team isn't allowed
|
||||
if(teamCount == 1 && compOnlyPlayerCount == 0)
|
||||
{
|
||||
teamCount = 0;
|
||||
}
|
||||
|
||||
if(waterContent == EWaterContent::RANDOM)
|
||||
{
|
||||
waterContent = static_cast<EWaterContent::EWaterContent>(rand.nextInt(EWaterContent::LAST_ITEM));
|
||||
|
||||
Reference in New Issue
Block a user