fix a bug in scoring of AI recall list. Patch by billynux

This commit is contained in:
Iurii Chernyi 2010-04-15 23:57:07 +00:00
parent eec9b77adf
commit 2157dd0326
3 changed files with 10 additions and 1 deletions

View file

@ -54,6 +54,7 @@ Version 1.9.0-svn:
* Added a way to compile wesnoth on windows by using CMake + MSVC9.
* Fixed the ping timeout not waiting for the default ping interval when
ping timeout is not set to 0
* Fixed a bug in scoring of AI recall list. Patch by billynux.
* Terrain animation related
* animated terrain animations are not synchronized anymore
* reworked macros to handle animations

View file

@ -868,6 +868,9 @@
[entry]
name = "Fredrik Wikstrom (salass00)"
[/entry]
[entry]
name = "Guillermo Biset (billynux)"
[/entry]
[entry]
name = "Hans-Joachim Gurt (HaJo)"
[/entry]

View file

@ -1644,13 +1644,18 @@ private:
};
template <class T, class V>
bool smaller_mapped_value(const std::pair<T,V>& a, const std::pair<T,V>& b)
{
return a.second < b.second;
}
class bad_recalls_remover {
public:
bad_recalls_remover(const std::map<std::string, int>& unit_combat_scores)
: allow_any_(false), best_combat_score_()
{
std::map<std::string, int>::const_iterator cs = std::min_element(unit_combat_scores.begin(),unit_combat_scores.end(),unit_combat_scores.value_comp());
std::map<std::string, int>::const_iterator cs = std::min_element(unit_combat_scores.begin(),unit_combat_scores.end(),&smaller_mapped_value<std::string,int>);
if (cs == unit_combat_scores.end()) {
allow_any_ = true;