1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

- fixed crash on start of some campaigns

- allowed on map factions is now set instead of bit field
This commit is contained in:
Ivan Savenko
2012-09-23 14:32:49 +00:00
parent 00c079f7dc
commit 3fcba4fb5c
10 changed files with 66 additions and 69 deletions

View File

@ -931,12 +931,11 @@ void CGameState::init(StartInfo * si)
{
if(it->second.castle==-1)
{
int f;
do
{
f = ran()%GameConstants::F_NUMBER;
}while(!(map->players[it->first].allowedFactions & 1<<f));
it->second.castle = f;
int randomID = ran() % map->players[it->first].allowedFactions.size();
auto iter = map->players[it->first].allowedFactions.begin();
std::advance(iter, randomID);
it->second.castle = *iter;
}
}