mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Support roads and teams customization in engine
This commit is contained in:
@@ -76,6 +76,11 @@ void CMapGenerator::loadConfig()
|
||||
config.pandoraMultiplierSpells = randomMapJson["pandoras"]["valueMultiplierSpells"].Integer();
|
||||
config.pandoraSpellSchool = randomMapJson["pandoras"]["valueSpellSchool"].Integer();
|
||||
config.pandoraSpell60 = randomMapJson["pandoras"]["valueSpell60"].Integer();
|
||||
//override config with game options
|
||||
if(!mapGenOptions.isRoadEnabled(config.secondaryRoadType))
|
||||
config.secondaryRoadType = "";
|
||||
if(!mapGenOptions.isRoadEnabled(config.defaultRoadType))
|
||||
config.defaultRoadType = config.secondaryRoadType;
|
||||
}
|
||||
|
||||
const CMapGenerator::Config & CMapGenerator::getConfig() const
|
||||
@@ -238,14 +243,21 @@ void CMapGenerator::addPlayerInfo()
|
||||
player.canHumanPlay = true;
|
||||
}
|
||||
|
||||
if (teamNumbers[j].empty())
|
||||
if(pSettings.getTeam() != TeamID::NO_TEAM)
|
||||
{
|
||||
logGlobal->error("Not enough places in team for %s player", ((j == CPUONLY) ? "CPU" : "CPU or human"));
|
||||
assert (teamNumbers[j].size());
|
||||
player.team = pSettings.getTeam();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (teamNumbers[j].empty())
|
||||
{
|
||||
logGlobal->error("Not enough places in team for %s player", ((j == CPUONLY) ? "CPU" : "CPU or human"));
|
||||
assert (teamNumbers[j].size());
|
||||
}
|
||||
auto itTeam = RandomGeneratorUtil::nextItem(teamNumbers[j], rand);
|
||||
player.team = TeamID(*itTeam);
|
||||
teamNumbers[j].erase(itTeam);
|
||||
}
|
||||
auto itTeam = RandomGeneratorUtil::nextItem(teamNumbers[j], rand);
|
||||
player.team = TeamID(*itTeam);
|
||||
teamNumbers[j].erase(itTeam);
|
||||
map->map().players[pSettings.getColor().getNum()] = player;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user