Refresh dedi console window title
This commit is contained in:
parent
d67aa26a5d
commit
84422b0fc0
@ -45,31 +45,39 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::string mapname = Dvar::Var("mapname").Get<const char*>();
|
std::string mapname = Dvar::Var("mapname").Get<const char*>();
|
||||||
std::string hostname = Colors::Strip(Dvar::Var("sv_hostname").Get<const char*>());
|
std::string hostname = Colors::Strip(Dvar::Var("sv_hostname").Get<const char*>());
|
||||||
SetConsoleTitleA(hostname.data());
|
|
||||||
|
|
||||||
int clientCount = 0;
|
if (Console::HasConsole)
|
||||||
int maxclientCount = *Game::svs_numclients;
|
|
||||||
|
|
||||||
if (maxclientCount)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < maxclientCount; ++i)
|
SetConsoleTitleA(hostname.data());
|
||||||
|
|
||||||
|
int clientCount = 0;
|
||||||
|
int maxclientCount = *Game::svs_numclients;
|
||||||
|
|
||||||
|
if (maxclientCount)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].state >= 3)
|
for (int i = 0; i < maxclientCount; ++i)
|
||||||
{
|
{
|
||||||
++clientCount;
|
if (Game::svs_clients[i].state >= 3)
|
||||||
|
{
|
||||||
|
++clientCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
//maxclientCount = Dvar::Var("sv_maxclients").Get<int>();
|
||||||
//maxclientCount = Dvar::Var("sv_maxclients").Get<int>();
|
maxclientCount = Game::Party_GetMaxPlayers(*Game::partyIngame);
|
||||||
maxclientCount = Game::Party_GetMaxPlayers(*Game::partyIngame);
|
clientCount = Game::PartyHost_CountMembers(reinterpret_cast<Game::PartyData_s*>(0x1081C00));
|
||||||
clientCount = Game::PartyHost_CountMembers(reinterpret_cast<Game::PartyData_s*>(0x1081C00));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
wclear(Console::InfoWindow);
|
wclear(Console::InfoWindow);
|
||||||
wprintw(Console::InfoWindow, "%s : %d/%d players : map %s", hostname.data(), clientCount, maxclientCount, (mapname.size() ? mapname.data() : "none"));
|
wprintw(Console::InfoWindow, "%s : %d/%d players : map %s", hostname.data(), clientCount, maxclientCount, (mapname.size() ? mapname.data() : "none"));
|
||||||
wnoutrefresh(Console::InfoWindow);
|
wnoutrefresh(Console::InfoWindow);
|
||||||
|
}
|
||||||
|
else if(IsWindow(*reinterpret_cast<HWND*>(0x64A3288)) != FALSE)
|
||||||
|
{
|
||||||
|
SetWindowTextA(*reinterpret_cast<HWND*>(0x64A3288), Utils::String::VA("IW4x(r" REVISION_STR REVISION_SUFFIX ") : %s", hostname.data()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::ShowPrompt()
|
void Console::ShowPrompt()
|
||||||
@ -126,7 +134,6 @@ namespace Components
|
|||||||
if ((currentTime - Console::LastRefresh) > 250)
|
if ((currentTime - Console::LastRefresh) > 250)
|
||||||
{
|
{
|
||||||
Console::RefreshOutput();
|
Console::RefreshOutput();
|
||||||
Console::RefreshStatus();
|
|
||||||
Console::LastRefresh = currentTime;
|
Console::LastRefresh = currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,6 +506,8 @@ namespace Components
|
|||||||
// Don't resize the console
|
// Don't resize the console
|
||||||
Utils::Hook(0x64DC6B, 0x64DCC2, HOOK_JUMP).Install()->Quick();
|
Utils::Hook(0x64DC6B, 0x64DCC2, HOOK_JUMP).Install()->Quick();
|
||||||
|
|
||||||
|
Dedicated::OnFrame(Console::RefreshStatus);
|
||||||
|
|
||||||
// Code below is not necessary when performing unit tests!
|
// Code below is not necessary when performing unit tests!
|
||||||
if (Loader::PerformingUnitTests()) return;
|
if (Loader::PerformingUnitTests()) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user