From cab2a1b8f1fa4ecd7c0000bfaa6f34f17b09e890 Mon Sep 17 00:00:00 2001 From: Goncalo Gomes Date: Wed, 13 Sep 2023 10:35:01 +0100 Subject: [PATCH] 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. --- src/ai/default/recruitment.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ai/default/recruitment.cpp b/src/ai/default/recruitment.cpp index cfc7cd32bfd..e8213cf944f 100644 --- a/src/ai/default/recruitment.cpp +++ b/src/ai/default/recruitment.cpp @@ -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.; } }