1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Update ally and enemy flags when selecting new template

This commit is contained in:
Tomasz Zieliński 2023-10-30 07:48:51 +01:00
parent 1028041eae
commit f39edf9413
2 changed files with 4 additions and 8 deletions

View File

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

View File

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