Skip to content

Commit

Permalink
fix(server/gui): 'FXServer/unknown' in console title
Browse files Browse the repository at this point in the history
At one point, the `gamename` variable moved to the fallback console
context, which made the code here only ever show 'unknown' instead of an
actual game name (like 'FXServer/gta5').

As a fix, we will look this up in the fallback console context as well.
  • Loading branch information
blattersturm committed Oct 11, 2023
1 parent 37fa83b commit 53959a4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion code/components/citizen-server-gui/src/ServerGui.cpp
Expand Up @@ -180,10 +180,19 @@ devgui_convar "Tools/Network/State/Player List" svplayerlist
auto conCtx = m_instance->GetComponent<console::Context>();
auto hostNameVar = conCtx->GetVariableManager()->FindEntryRaw("sv_hostname");
auto iconVar = conCtx->GetVariableManager()->FindEntryRaw("sv_icon");
auto gameNameVar = conCtx->GetVariableManager()->FindEntryRaw("gamename");

if (hostNameVar && consoleWindowState.lastHostname != hostNameVar->GetValue())
{
auto gameNameVar = conCtx->GetVariableManager()->FindEntryRaw("gamename");

if (!gameNameVar)
{
if (auto fallbackContext = conCtx->GetFallbackContext())
{
gameNameVar = fallbackContext->GetVariableManager()->FindEntryRaw("gamename");
}
}

consoleWindowState.lastHostname = hostNameVar->GetValue();

SetConsoleTitle(fmt::sprintf(L"Cfx.re Server (FXServer/%s) - %s", ToWide((gameNameVar) ? gameNameVar->GetValue() : "unknown"), ToWide(consoleWindowState.lastHostname)).c_str());
Expand Down

0 comments on commit 53959a4

Please sign in to comment.