mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 10:32:56 +00:00
Hide AIs with hidden=yes from list of available AI options (fixes #2095)
This is enough to hide them as AI options in the UI, but I don't know if other parts of the AI engine need to know about this key.
This commit is contained in:
parent
3c0e873e84
commit
b2df837d8e
@ -2,6 +2,7 @@
|
||||
[ai]
|
||||
id=idle_ai
|
||||
description=_"Multiplayer_AI^Dev AI: Idle AI" # wmllint: no spellcheck
|
||||
hidden=yes
|
||||
# Needs to define at least one stage; otherwise, the default AI will be injected
|
||||
# when used with [modify_side]switch_ai or when loading a mid-scenario save
|
||||
[stage]
|
||||
|
@ -114,20 +114,32 @@ void configuration::add_mod_ai_from_config(config::const_child_itors mods)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<description*> configuration::get_available_ais(){
|
||||
std::vector<description*> configuration::get_available_ais()
|
||||
{
|
||||
std::vector<description*> ais_list;
|
||||
for(description_map::iterator desc = ai_configurations_.begin(); desc!=ai_configurations_.end(); ++desc) {
|
||||
ais_list.push_back(&desc->second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << desc->second.cfg<< std::endl;
|
||||
|
||||
for(auto& a_config : ai_configurations_) {
|
||||
ais_list.push_back(&a_config.second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << a_config.second.cfg<< std::endl;
|
||||
}
|
||||
for(description_map::iterator desc = era_ai_configurations_.begin(); desc!=era_ai_configurations_.end(); ++desc) {
|
||||
ais_list.push_back(&desc->second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << desc->second.cfg<< std::endl;
|
||||
|
||||
for(auto& e_config : era_ai_configurations_) {
|
||||
ais_list.push_back(&e_config.second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << e_config.second.cfg<< std::endl;
|
||||
}
|
||||
for(description_map::iterator desc = mod_ai_configurations_.begin(); desc!=mod_ai_configurations_.end(); ++desc) {
|
||||
ais_list.push_back(&desc->second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << desc->second.cfg<< std::endl;
|
||||
|
||||
for(auto& m_config : mod_ai_configurations_) {
|
||||
ais_list.push_back(&m_config.second);
|
||||
DBG_AI_CONFIGURATION << "has ai with config: "<< std::endl << m_config.second.cfg<< std::endl;
|
||||
}
|
||||
|
||||
// Remove any AIs marked hidden.
|
||||
const auto new_end = std::remove_if(ais_list.begin(), ais_list.end(),
|
||||
[](description* d) { return d->cfg["hidden"].to_bool(false); }
|
||||
);
|
||||
|
||||
ais_list.erase(new_end, ais_list.end());
|
||||
|
||||
return ais_list;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user