small fix
This commit is contained in:
parent
3af1d21166
commit
8b02cee500
@ -673,13 +673,13 @@ namespace game_console
|
|||||||
return false;
|
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);
|
input = utils::string::to_lower(input);
|
||||||
|
|
||||||
for (const auto& dvar : dvars::dvar_list)
|
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))
|
if (game::Dvar_FindVar(name.data()) && match_compare(input, name, exact))
|
||||||
{
|
{
|
||||||
suggestions.push_back(dvar);
|
suggestions.push_back(dvar);
|
||||||
@ -693,7 +693,7 @@ namespace game_console
|
|||||||
|
|
||||||
if (suggestions.size() == 0 && game::Dvar_FindVar(input.data()))
|
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);
|
game::cmd_function_s* cmd = (*game::cmd_functions);
|
||||||
@ -703,9 +703,9 @@ namespace game_console
|
|||||||
{
|
{
|
||||||
std::string name = utils::string::to_lower(cmd->name);
|
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)
|
if (exact && suggestions.size() > 1)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
namespace game_console
|
namespace game_console
|
||||||
{
|
{
|
||||||
@ -6,5 +7,5 @@ namespace game_console
|
|||||||
bool console_key_event(int local_client_num, int key, int down);
|
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);
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user