From d1ba9a33a387a14ae06008c781e2af54d546366e Mon Sep 17 00:00:00 2001 From: mattsc Date: Thu, 12 Apr 2018 10:08:50 -0700 Subject: [PATCH] AI recruitment: use unit-specific recall cost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … when deciding whether a recall is worth it. (cherry picked from commit 0119413910591aa9e8ced71c9702271df51b67c4) --- src/ai/default/recruitment.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ai/default/recruitment.cpp b/src/ai/default/recruitment.cpp index feacc0f6e24f..9fbcbc5d62ee 100644 --- a/src/ai/default/recruitment.cpp +++ b/src/ai/default/recruitment.cpp @@ -499,7 +499,11 @@ double recruitment::recall_unit_value(const unit_const_ptr & recall_unit) const double xp_quantity = static_cast(recall_unit->experience()) / recall_unit->max_experience(); double recall_value = recall_unit->cost() + xp_quantity * average_cost_of_advanced_unit; - if (recall_value < current_team().recall_cost()) { + int cost = current_team().recall_cost(); + if (recall_unit->recall_cost() > -1) { + cost=recall_unit->recall_cost(); + } + if (recall_value < cost) { recall_value = -1; // Unit is not worth to get recalled. } return recall_value;