From 5beed0a0f57ab8598d2c5a7335857dfcfbec3c9a Mon Sep 17 00:00:00 2001 From: Aishiko Date: Sun, 23 Mar 2014 21:51:59 -0400 Subject: [PATCH] Correct gold check comparision in recall cost By correcting the assignment of the cost of the unit it now correctly says whether or not the play actually has the gold to recall a unit, as after this check it is assumed they do by the program which creates the possibility of recalling when you have no gold, or negative gold. Added comments so that the magic number is explained. --- src/menu_events.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/menu_events.cpp b/src/menu_events.cpp index bec37f637a37..66d736499002 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -693,7 +693,11 @@ void menu_handler::recall(int side_num, const map_location &last_hex) if (res < 0) { return; } - else if(recall_list_team[res]->recall_cost() < 0) { + // we need to check if unit has a specific recall cost + // if it does we use it elsewise we use the team.recall_cost() + // the magic number -1 is what it gets set to if the unit doesn't + // have a special recall_cost of its own. + else if(recall_list_team[res]->recall_cost() > -1) { unit_cost = recall_list_team[res]->recall_cost(); }