From 4a21841ce2b6a20b778e4c02faaaf1d20f66f82d Mon Sep 17 00:00:00 2001 From: Dydzio Date: Mon, 29 Apr 2019 07:45:30 +0200 Subject: [PATCH] Check other players startinfo for random hero pick (#580) --- lib/CGameState.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index df7fae5c7..316b4fd62 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -2711,6 +2711,12 @@ std::set CGameState::getUnusedAllowedHeroes(bool alsoIncludeNotAllow for(int i = 0; i < map->allowedHeroes.size(); i++) if(map->allowedHeroes[i] || alsoIncludeNotAllowed) ret.insert(HeroTypeID(i)); + + for(auto & playerSettingPair : scenarioOps->playerInfos) //remove uninitialized yet heroes picked for start by other players + { + if(playerSettingPair.second.hero != PlayerSettings::RANDOM) + ret -= HeroTypeID(playerSettingPair.second.hero); + } for(auto hero : map->heroesOnMap) //heroes instances initialization {