Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void debug_print_recall_list_scores(const std::vector< std::pair<std::string,double> > &recall_list_scores,const char *message)
- {
- if (!lg::debug.dont_log(log_ai)) {
- std::stringstream s;
- s << message << std::endl;
- for (std::vector< std::pair<std::string,double> >::const_iterator p = recall_list_scores.begin(); p!=recall_list_scores.end();++p) {
- s << p->first << " ["<<p->second<<"]"<<std::endl;
- }
- DBG_AI << s.str();
- }
- }
- bool ai_default_recruitment_stage::analyze_recall_list()
- {
- if (current_team().gold() < current_team().recall_cost() ) {
- return false;
- }
- const std::vector<unit> &recalls = current_team().recall_list();
- if (recalls.empty()) {
- return false;
- }
- std::transform(recalls.begin(), recalls.end(), std::back_inserter< std::vector <std::pair<std::string,double> > > (recall_list_scores_), unit_combat_score_getter(*this) );
- debug_print_recall_list_scores(recall_list_scores_,"Recall list, after scoring:");
- recall_list_scores_.erase( std::remove_if(recall_list_scores_.begin(), recall_list_scores_.end(), bad_recalls_remover(unit_combat_scores_)), recall_list_scores_.end() );
- debug_print_recall_list_scores(recall_list_scores_,"Recall list, after erase:");
- if (recall_list_scores_.empty()) {
- return false;
- }
- sort(recall_list_scores_.begin(),recall_list_scores_.end(),combat_score_less());
- debug_print_recall_list_scores(recall_list_scores_,"Recall list, after sort (worst to best):");
- return !(recall_list_scores_.empty());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement