1
0
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:
DjWarmonger
2014-05-24 22:10:46 +02:00
parent b9de3875d9
commit 69457dbd75
2 changed files with 50 additions and 45 deletions

View File

@@ -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));