bool recruit_result::test_enough_gold(const team &my_team, const unit_type &type, bool) { if (my_team.gold() < type.cost()) { set_error(E_NO_GOLD); return false; } return true; }
void ai_default_recruitment_stage::get_combat_score_vs(const unit_type& ut, const std::string &enemy_type_id, int &score, int &weighting, int hitpoints, int max_hitpoints) const { const unit_type *enemy_info = unit_types.find(enemy_type_id); VALIDATE(enemy_info, "Unknown unit type : " + enemy_type_id + " while scoring units."); int weight = ut.cost(); if ((hitpoints>0) && (max_hitpoints>0)) { weight = weight * hitpoints / max_hitpoints; } weighting += weight; score += compare_unit_types(ut, *enemy_info) * weight; }