mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-27 12:22:45 +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);
|
skills.push_back(possible);
|
||||||
if (secSkillProbability.count(possible) != 0)
|
if (secSkillProbability.count(possible) != 0)
|
||||||
weights.push_back(secSkillProbability.at(possible));
|
{
|
||||||
|
int weight = secSkillProbability.at(possible);
|
||||||
|
weights.push_back(std::max(1, weight));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
weights.push_back(1); // H3 behavior - banned skills have minimal (1) chance to be picked
|
weights.push_back(1); // H3 behavior - banned skills have minimal (1) chance to be picked
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user