mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
Fix possible crash on levelup when hero can only levelup banned skills
This commit is contained in:
parent
f0a71c9e21
commit
a7a9f5d777
@ -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…
Reference in New Issue
Block a user