1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Add PrepareHeroLevelUp netpack to keep secondary skills RNG in sync

This commit is contained in:
Arseniy Shestakov
2016-09-08 00:24:05 +03:00
parent ca819b3cda
commit 53502e84e3
4 changed files with 40 additions and 3 deletions

View File

@@ -213,20 +213,24 @@ void CGameHandler::levelUpHero(const CGHeroInstance * hero)
sps.val = 1;
sendAndApply(&sps);
PrepareHeroLevelUp pre;
pre.hero = hero;
sendAndApply(&pre);
HeroLevelUp hlu;
hlu.hero = hero;
hlu.primskill = primarySkill;
hlu.skills = hero->getLevelUpProposedSecondarySkills();
hlu.skills = pre.skills;
if(hlu.skills.size() == 0)
{
sendAndApply(&hlu);
levelUpHero(hero);
}
else if(hlu.skills.size() == 1 || hero->tempOwner == PlayerColor::NEUTRAL) //choose skill automatically
else if(hlu.skills.size() == 1)
{
sendAndApply(&hlu);
levelUpHero(hero, *RandomGeneratorUtil::nextItem(hlu.skills, hero->skillsInfo.rand));
levelUpHero(hero, pre.skills.front());
}
else if(hlu.skills.size() > 1)
{