mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Merge pull request #4943 from IvanSavenko/levelup_fix
Fix possible crash on levelup when hero can only levelup banned skills
This commit is contained in:
commit
03273ed324
@ -30,7 +30,10 @@ SecondarySkill CHeroClass::chooseSecSkill(const std::set<SecondarySkill> & possi
|
||||
{
|
||||
skills.push_back(possible);
|
||||
if (secSkillProbability.count(possible) != 0)
|
||||
weights.push_back(secSkillProbability.at(possible));
|
||||
{
|
||||
int weight = secSkillProbability.at(possible);
|
||||
weights.push_back(std::max(1, weight));
|
||||
}
|
||||
else
|
||||
weights.push_back(1); // H3 behavior - banned skills have minimal (1) chance to be picked
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user