SHARE
TWEET

Untitled

a guest May 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static void debug_print_recall_list_scores(const std::vector< std::pair<std::string,double> > &recall_list_scores,const char *message)
  2. {
  3.         if (!lg::debug.dont_log(log_ai)) {
  4.                 std::stringstream s;
  5.                 s << message << std::endl;
  6.                 for (std::vector< std::pair<std::string,double> >::const_iterator p = recall_list_scores.begin(); p!=recall_list_scores.end();++p) {
  7.                         s << p->first << " ["<<p->second<<"]"<<std::endl;
  8.                 }
  9.                 DBG_AI << s.str();
  10.         }
  11.  
  12.  
  13. }
  14.  
  15. bool ai_default_recruitment_stage::analyze_recall_list()
  16. {
  17.         if (current_team().gold() < current_team().recall_cost() ) {
  18.                 return false;
  19.         }
  20.  
  21.         const std::vector<unit> &recalls = current_team().recall_list();
  22.  
  23.         if (recalls.empty()) {
  24.                 return false;
  25.         }
  26.  
  27.         std::transform(recalls.begin(), recalls.end(), std::back_inserter< std::vector <std::pair<std::string,double> > > (recall_list_scores_), unit_combat_score_getter(*this) );
  28.  
  29.         debug_print_recall_list_scores(recall_list_scores_,"Recall list, after scoring:");
  30.  
  31.         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() );
  32.  
  33.         debug_print_recall_list_scores(recall_list_scores_,"Recall list, after erase:");
  34.  
  35.         if (recall_list_scores_.empty()) {
  36.                 return false;
  37.         }
  38.  
  39.         sort(recall_list_scores_.begin(),recall_list_scores_.end(),combat_score_less());
  40.  
  41.         debug_print_recall_list_scores(recall_list_scores_,"Recall list, after sort (worst to best):");
  42.  
  43.         return !(recall_list_scores_.empty());
  44. }
RAW Paste Data
Top