1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Less "crashy" campaigns.

This commit is contained in:
Michał W. Urbańczyk 2010-10-30 18:54:59 +00:00
parent 0e12c1419e
commit 0f36095dc7

View File

@ -1703,7 +1703,10 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
if (hp->subID == 0xFF) //select by power
{
HLP::replaceHero(this, g, Xheroes[hp->power - 1]);
if(Xheroes.size() > hp->power - 1)
HLP::replaceHero(this, g, Xheroes[hp->power - 1]);
else
tlog2 << "Warning, to hero to replace!\n";
//we don't have to remove hero from Xheroes because it would destroy the order and duplicates shouldn't happen
}
}
@ -1863,7 +1866,10 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
maxB = b;
}
}
HLP::giveCampaignBonusToHero(heroes[maxB], scenarioOps, campaign->camp->scenarios[scenarioOps->whichMapInCampaign].travelOptions);
if(maxB < 0)
tlog2 << "Warning - cannot give bonus to hero cause there are no heroes!\n";
else
HLP::giveCampaignBonusToHero(heroes[maxB], scenarioOps, campaign->camp->scenarios[scenarioOps->whichMapInCampaign].travelOptions);
}
else //specific hero
{