mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 15:10:28 +00:00
fix #7821: all cases of the calculation should be cached
in the previous logic some cases return from the function and others would set a return variable that would be set later. this commit, changes all the cases into all assignment.
This commit is contained in:
parent
e0b130434a
commit
cab2a1b8f1
@ -933,11 +933,11 @@ double recruitment::compare_unit_types(const std::string& a, const std::string&
|
||||
double value_of_b = damage_to_a / (a_max_hp * b_cost);
|
||||
|
||||
if (value_of_a > value_of_b) {
|
||||
return value_of_a / value_of_b;
|
||||
retval = value_of_a / value_of_b;
|
||||
} else if (value_of_a < value_of_b) {
|
||||
return -value_of_b / value_of_a;
|
||||
retval = -value_of_b / value_of_a;
|
||||
} else {
|
||||
return 0.;
|
||||
retval = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user