skillcalc: only recompute xp bonus values once when bonus changes

This commit is contained in:
Adam
2021-10-26 21:43:10 -04:00
parent 265e939116
commit b9191114fa

View File

@@ -272,19 +272,15 @@ class SkillCalculator extends JPanel
private void adjustCheckboxes(JCheckBox target, SkillBonus bonus) private void adjustCheckboxes(JCheckBox target, SkillBonus bonus)
{ {
adjustXPBonus(0); for (JCheckBox otherSelectedCheckbox : bonusCheckBoxes)
bonusCheckBoxes.forEach(otherSelectedCheckbox ->
{ {
if (otherSelectedCheckbox != target) if (otherSelectedCheckbox != target)
{ {
otherSelectedCheckbox.setSelected(false); otherSelectedCheckbox.setSelected(false);
} }
});
if (target.isSelected())
{
adjustXPBonus(bonus.getValue());
} }
adjustXPBonus(target.isSelected() ? bonus.getValue() : 0f);
} }
private void renderActionSlots() private void renderActionSlots()