Merge pull request #231 from Lierrmm/main

feat: remove color prefixes from server name in console title
This commit is contained in:
Maurice Heumann 2023-02-24 13:40:07 +01:00 committed by GitHub
commit 5098e586f5
2 changed files with 7 additions and 3 deletions

View File

@ -16,18 +16,19 @@ namespace dedicated_info
void set_server_info_in_console_title()
{
const auto sv_running = game::Dvar_FindVar("sv_running");
const auto server_name = game::get_dvar_string("live_steam_server_name");
auto server_name = game::get_dvar_string("live_steam_server_name");
auto clean_server_name = game::I_CleanStr(server_name.data());
if (!sv_running || !sv_running->current.enabled)
{
console::set_title(server_name + " - not running");
console::set_title(utils::string::va("%s - not running", clean_server_name));
return;
}
const auto mapname = game::get_dvar_string("mapname");
const std::string window_text = utils::string::va("%s on %s [%d/%d] (%d)",
server_name.data(),
clean_server_name,
mapname.data(),
getinfo::get_client_count(),
getinfo::get_max_client_count(),

View File

@ -131,6 +131,9 @@ namespace game
WEAK symbol<void(client_s* cl_0, svscmd_type type, const char* fmt, ...)> SV_SendServerCommand{0x0, 0x140537F10};
WEAK symbol<bool(int clientNum)> SV_IsTestClient{0x14224B5C0, 0x14052FF40};
// Utils
WEAK symbol<const char* (char* str)> I_CleanStr{0x1422E9C10, 0x140580E80};
// Variables
WEAK symbol<cmd_function_s> cmd_functions{0x15689FF58, 0x14946F860};