Skip to content

Commit

Permalink
AI configuration: invert mp_rank based ordering
Browse files Browse the repository at this point in the history
This is supposed to be equivalent to the campaign rank, so it should be in ascending order.
  • Loading branch information
mattsc committed Dec 18, 2018
1 parent 650a780 commit 4d43b21
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion data/ai/ais/ai_default_rca.cfg
Expand Up @@ -8,7 +8,7 @@
id=ai_default_rca
description=_"Multiplayer_AI^Default AI (RCA)" # wmllint: no spellcheck
# RCA := Register Candidate Action; more info at https://forums.wesnoth.org/viewtopic.php?p=419625#p419625
mp_rank=1010
mp_rank=1000
[stage]
id=main_loop
name=ai_default_rca::candidate_action_evaluation_loop
Expand Down
2 changes: 1 addition & 1 deletion data/ai/ais/ai_generic_rush.cfg
Expand Up @@ -8,6 +8,6 @@
[ai]
id=experimental_ai
description=_"Multiplayer_AI^Experimental AI" # wmllint: no spellcheck
mp_rank=1000
mp_rank=1010
{EXPERIMENTAL_AI}
[/ai]
2 changes: 1 addition & 1 deletion data/ai/dev/ai_default_rca_alternate_recruiting.cfg
Expand Up @@ -9,7 +9,7 @@
id=ai_default_rca_alternate_recruiting
description=_"Multiplayer_AI^Dev AI: Default AI (RCA) with Alternate Recruiting" # wmllint: no spellcheck
# RCA := Register Candidate Action; more info at https://forums.wesnoth.org/viewtopic.php?p=419625#p419625
mp_rank=100
mp_rank=100000
[stage]
id=main_loop
name=ai_default_rca::candidate_action_evaluation_loop
Expand Down
2 changes: 1 addition & 1 deletion data/ai/dev/formula_ai.cfg
Expand Up @@ -8,7 +8,7 @@
[ai]
id=formula_ai # id is needed to uniquely identify a MP AI, it is not needed in the scenario AI
description=_"Multiplayer_AI^Dev AI: Default + Experimental Recruitment (Formula AI)" # wmllint: no spellcheck
mp_rank=100
mp_rank=100000
# this description is, again, needed for MP AI (it shows in AI list under this description

[stage]
Expand Down
2 changes: 1 addition & 1 deletion data/ai/dev/formula_ai_poisoning.cfg
Expand Up @@ -7,7 +7,7 @@
[ai]
id=formula_ai_poisoning
description=_"Multiplayer_AI^Dev AI: Default + Poisoning (Formula AI)" # wmllint: no spellcheck
mp_rank=100
mp_rank=100000
[stage]
id=main_loop
name=ai_default_rca::candidate_action_evaluation_loop
Expand Down
6 changes: 3 additions & 3 deletions src/ai/configuration.cpp
Expand Up @@ -69,7 +69,7 @@ void configuration::init(const config &game_config)

description desc;
desc.id=id;
desc.mp_rank=ai_configuration["mp_rank"].to_int(0);
desc.mp_rank=ai_configuration["mp_rank"].to_int(std::numeric_limits<int>::max());
desc.text = ai_configuration["description"].t_str();
desc.cfg=ai_configuration;

Expand All @@ -96,7 +96,7 @@ void extract_ai_configurations(std::map<std::string, description> &storage, cons
description desc;
desc.id=id;
desc.text = ai_configuration["description"].t_str();
desc.mp_rank = ai_configuration["mp_rank"].to_int(0);
desc.mp_rank = ai_configuration["mp_rank"].to_int(std::numeric_limits<int>::max());
desc.cfg=ai_configuration;

storage.emplace(id, desc);
Expand Down Expand Up @@ -148,7 +148,7 @@ std::vector<description*> configuration::get_available_ais()
// Sort by mp_rank. For same mp_rank, keep alphabetical order.
std::stable_sort(ais_list.begin(), ais_list.end(),
[](const description* a, const description* b) {
return a->mp_rank > b->mp_rank;
return a->mp_rank < b->mp_rank;
}
);

Expand Down

0 comments on commit 4d43b21

Please sign in to comment.