Fix bug #19284: Autocomplete player names in commands

This commit is contained in:
Ali El Gariani 2012-01-14 22:51:40 +00:00
parent 702d49cd0f
commit f1280d5143

View file

@ -912,12 +912,6 @@ void play_controller::tab()
std::set<std::string> dictionary;
switch(mode) {
case gui::TEXTBOX_COMMAND:
{
std::vector<std::string> commands = menu_handler_.get_commands_list();
dictionary.insert(commands.begin(), commands.end());
break;
}
case gui::TEXTBOX_SEARCH:
{
foreach (const unit &u, units_){
@ -929,6 +923,12 @@ void play_controller::tab()
//TODO List map labels
break;
}
case gui::TEXTBOX_COMMAND:
{
std::vector<std::string> commands = menu_handler_.get_commands_list();
dictionary.insert(commands.begin(), commands.end());
// no break here, we also want player names from the next case
}
case gui::TEXTBOX_MESSAGE:
{
foreach(const team& t, teams_) {
@ -943,9 +943,9 @@ void play_controller::tab()
//Exclude own nick from tab-completion.
//NOTE why ?
dictionary.erase(preferences::login());
break;
}
default:
ERR_DP << "unknown textbox mode\n";
} //switch(mode)