1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Implemented deterministic secondary skills, #1166.

This commit is contained in:
DjWarmonger
2013-09-09 15:23:59 +00:00
parent a1d3bcb276
commit 39f9069ed9
6 changed files with 111 additions and 5 deletions

View File

@@ -205,7 +205,11 @@ void CGameHandler::levelUpHero(const CGHeroInstance * hero)
else if(hlu.skills.size() == 1 || hero->tempOwner == PlayerColor::NEUTRAL) //choose skill automatically
{
sendAndApply(&hlu);
levelUpHero(hero, vstd::pickRandomElementOf (hlu.skills, rand));
auto rng = [&]()-> ui32
{
return hero->skillsInfo.randomSeed; //must be determined
};
levelUpHero(hero, vstd::pickRandomElementOf (hlu.skills, rng));
}
else if(hlu.skills.size() > 1)
{