1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

[Map format, PreGame] allow selection of any allowed faction

This commit is contained in:
AlexVinS
2017-11-16 02:06:07 +03:00
parent b8d0dfac5f
commit d7366f04a9
2 changed files with 27 additions and 14 deletions

View File

@@ -36,14 +36,14 @@ PlayerInfo::PlayerInfo(): canHumanPlay(false), canComputerPlay(false),
si8 PlayerInfo::defaultCastle() const
{
if(allowedFactions.size() == 1 || !isFactionRandom)
{
// faction can't be chosen - set to first that is marked as allowed
assert(!allowedFactions.empty());
return *allowedFactions.begin();
}
//if random allowed set it as default
if(isFactionRandom)
return -1;
// set to random
if(!allowedFactions.empty())
return *allowedFactions.begin();
// fall back to random
return -1;
}