small fix

This commit is contained in:
m 2022-03-13 07:59:35 -05:00
parent be19c5edc7
commit aca747e5d9
2 changed files with 7 additions and 6 deletions

View File

@ -673,13 +673,13 @@ namespace game_console
return false;
}
void find_matches(std::string input, std::vector<std::string>& suggestions, const bool exact)
void find_matches(std::string input, std::vector<dvars::dvar_info>& suggestions, const bool exact)
{
input = utils::string::to_lower(input);
for (const auto& dvar : dvars::dvar_list)
{
auto name = utils::string::to_lower(dvar);
auto name = utils::string::to_lower(dvar.name);
if (game::Dvar_FindVar(name.data()) && match_compare(input, name, exact))
{
suggestions.push_back(dvar);
@ -693,7 +693,7 @@ namespace game_console
if (suggestions.size() == 0 && game::Dvar_FindVar(input.data()))
{
suggestions.push_back(input.data());
suggestions.push_back({ input.data(), "" });
}
game::cmd_function_s* cmd = (*game::cmd_functions);
@ -703,9 +703,9 @@ namespace game_console
{
std::string name = utils::string::to_lower(cmd->name);
if (game_console::match_compare(input, name, exact))
if (match_compare(input, name, exact))
{
suggestions.push_back(cmd->name);
suggestions.push_back({ cmd->name, "" });
}
if (exact && suggestions.size() > 1)

View File

@ -1,4 +1,5 @@
#pragma once
#include "game/dvars.hpp"
namespace game_console
{
@ -6,5 +7,5 @@ namespace game_console
bool console_key_event(int local_client_num, int key, int down);
bool match_compare(const std::string& input, const std::string& text, const bool exact);
void find_matches(std::string input, std::vector<std::string>& suggestions, const bool exact);
void find_matches(std::string input, std::vector<dvars::dvar_info>& suggestions, const bool exact);
}