mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +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();
|
mapInfo->mapHeader->twoLevel = mapGenOptions->getHasTwoLevels();
|
||||||
|
|
||||||
// Generate player information
|
// Generate player information
|
||||||
int playersToGen = PlayerColor::PLAYER_LIMIT_I;
|
int playersToGen = mapGenOptions->getMaxPlayersCount();
|
||||||
if(mapGenOptions->getHumanOrCpuPlayerCount() != CMapGenOptions::RANDOM_SIZE)
|
|
||||||
{
|
|
||||||
playersToGen = mapGenOptions->getHumanOrCpuPlayerCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
mapInfo->mapHeader->howManyTeams = playersToGen;
|
mapInfo->mapHeader->howManyTeams = playersToGen;
|
||||||
|
|
||||||
@ -224,7 +220,6 @@ void RandomMapTab::updateMapInfoByHost()
|
|||||||
mapInfoChanged(mapInfo, mapGenOptions);
|
mapInfoChanged(mapInfo, mapGenOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method only sets GUI options, doesn't alter any actual configurations done
|
|
||||||
void RandomMapTab::setMapGenOptions(std::shared_ptr<CMapGenOptions> opts)
|
void RandomMapTab::setMapGenOptions(std::shared_ptr<CMapGenOptions> opts)
|
||||||
{
|
{
|
||||||
mapGenOptions = opts;
|
mapGenOptions = opts;
|
||||||
|
@ -250,7 +250,7 @@ void CMapGenOptions::initPlayersMap()
|
|||||||
void CMapGenOptions::resetPlayersMap()
|
void CMapGenOptions::resetPlayersMap()
|
||||||
{
|
{
|
||||||
// Called when number of player changes
|
// 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();
|
savePlayersMap();
|
||||||
|
|
||||||
@ -449,6 +449,8 @@ void CMapGenOptions::setMapTemplate(const CRmgTemplate * value)
|
|||||||
}
|
}
|
||||||
if(!mapTemplate->getWaterContentAllowed().count(getWaterContent()))
|
if(!mapTemplate->getWaterContentAllowed().count(getWaterContent()))
|
||||||
setWaterContent(EWaterContent::RANDOM);
|
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);
|
auto it = players.find(color);
|
||||||
assert(it != players.end());
|
assert(it != players.end());
|
||||||
// TODO: Make pivate friend method to avoid unintended changes?
|
|
||||||
it->second.setTeam(team);
|
it->second.setTeam(team);
|
||||||
customizedPlayers = true;
|
customizedPlayers = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user