mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Update ally and enemy flags when selecting new template
This commit is contained in:
parent
1028041eae
commit
f39edf9413
@ -183,11 +183,7 @@ void RandomMapTab::updateMapInfoByHost()
|
||||
mapInfo->mapHeader->twoLevel = mapGenOptions->getHasTwoLevels();
|
||||
|
||||
// Generate player information
|
||||
int playersToGen = PlayerColor::PLAYER_LIMIT_I;
|
||||
if(mapGenOptions->getHumanOrCpuPlayerCount() != CMapGenOptions::RANDOM_SIZE)
|
||||
{
|
||||
playersToGen = mapGenOptions->getHumanOrCpuPlayerCount();
|
||||
}
|
||||
int playersToGen = mapGenOptions->getMaxPlayersCount();
|
||||
|
||||
mapInfo->mapHeader->howManyTeams = playersToGen;
|
||||
|
||||
@ -224,7 +220,6 @@ void RandomMapTab::updateMapInfoByHost()
|
||||
mapInfoChanged(mapInfo, mapGenOptions);
|
||||
}
|
||||
|
||||
// This method only sets GUI options, doesn't alter any actual configurations done
|
||||
void RandomMapTab::setMapGenOptions(std::shared_ptr<CMapGenOptions> opts)
|
||||
{
|
||||
mapGenOptions = opts;
|
||||
|
@ -250,7 +250,7 @@ void CMapGenOptions::initPlayersMap()
|
||||
void CMapGenOptions::resetPlayersMap()
|
||||
{
|
||||
// Called when number of player changes
|
||||
//But do not update info about already made selections
|
||||
// But do not update info about already made selections
|
||||
|
||||
savePlayersMap();
|
||||
|
||||
@ -449,6 +449,8 @@ void CMapGenOptions::setMapTemplate(const CRmgTemplate * value)
|
||||
}
|
||||
if(!mapTemplate->getWaterContentAllowed().count(getWaterContent()))
|
||||
setWaterContent(EWaterContent::RANDOM);
|
||||
|
||||
resetPlayersMap(); // Update teams and player count
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,7 +486,6 @@ void CMapGenOptions::setPlayerTeam(const PlayerColor & color, const TeamID & tea
|
||||
{
|
||||
auto it = players.find(color);
|
||||
assert(it != players.end());
|
||||
// TODO: Make pivate friend method to avoid unintended changes?
|
||||
it->second.setTeam(team);
|
||||
customizedPlayers = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user