From bbd33127059029b35aad524f4d2782ce98c2966f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 12 Nov 2023 19:18:17 +0200 Subject: [PATCH] Fix randomization of heroes in campaigns --- lib/gameState/CGameStateCampaign.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gameState/CGameStateCampaign.cpp b/lib/gameState/CGameStateCampaign.cpp index f67ed7311..6ba1a44d6 100644 --- a/lib/gameState/CGameStateCampaign.cpp +++ b/lib/gameState/CGameStateCampaign.cpp @@ -217,6 +217,10 @@ void CGameStateCampaign::placeCampaignHeroes() for(auto & heroID : heroesToRemove) { + // Do not replace reserved heroes initially, e.g. in 1st campaign scenario in which they appear + if (campaignState->getHeroByType(heroID).isNull()) + continue; + auto * hero = gameState->getUsedHero(heroID); if(hero) {