Changes server console title
- Separate function - Changing the window title when the server is not running
This commit is contained in:
parent
ab4f918909
commit
c2dca8c081
@ -11,18 +11,20 @@
|
||||
|
||||
namespace dedicated_info
|
||||
{
|
||||
class component final : public server_component
|
||||
namespace
|
||||
{
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
scheduler::loop([]()
|
||||
void set_server_info_in_console_title()
|
||||
{
|
||||
const auto sv_running = game::Dvar_FindVar("sv_running");
|
||||
|
||||
if (sv_running && sv_running->current.enabled)
|
||||
{
|
||||
const auto server_name = game::get_dvar_string("live_steam_server_name");
|
||||
|
||||
if (!sv_running || !sv_running->current.enabled)
|
||||
{
|
||||
std::string idle_text = server_name + " - not running";
|
||||
console::set_title(idle_text);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto mapname = game::get_dvar_string("mapname");
|
||||
|
||||
std::string window_text = utils::string::va("%s on %s [%d/%d] (%d)",
|
||||
@ -34,6 +36,15 @@ namespace dedicated_info
|
||||
|
||||
console::set_title(window_text);
|
||||
}
|
||||
}
|
||||
class component final : public server_component
|
||||
{
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
scheduler::loop([]()
|
||||
{
|
||||
set_server_info_in_console_title();
|
||||
}, scheduler::pipeline::main, 1s);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user