Skip to content

Commit

Permalink
Correct gold check comparision in recall cost
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Aishiko committed Mar 24, 2014
1 parent 2a923b5 commit 5beed0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/menu_events.cpp
Expand Up @@ -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();
}

Expand Down

0 comments on commit 5beed0a

Please sign in to comment.