Rename class 'IBrowser' to 'CBrowser'

Renamed 'g_pIBrowser' to 'g_pBrowser' as well
This commit is contained in:
Kawe Mazidjatari 2022-05-27 02:44:36 +02:00
parent 555eb264c1
commit 58d46c0a8c
6 changed files with 45 additions and 45 deletions

View File

@ -39,7 +39,7 @@ History:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
IBrowser::IBrowser(void)
CBrowser::CBrowser(void)
{
memset(m_szServerAddressBuffer, '\0', sizeof(m_szServerAddressBuffer));
#ifndef CLIENT_DLL
@ -60,7 +60,7 @@ IBrowser::IBrowser(void)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
IBrowser::~IBrowser(void)
CBrowser::~CBrowser(void)
{
//delete r5net;
}
@ -68,7 +68,7 @@ IBrowser::~IBrowser(void)
//-----------------------------------------------------------------------------
// Purpose: draws the main browser front-end
//-----------------------------------------------------------------------------
void IBrowser::Draw(const char* pszTitle, bool* bDraw)
void CBrowser::Draw(const char* pszTitle, bool* bDraw)
{
if (!m_bInitialized)
{
@ -123,7 +123,7 @@ void IBrowser::Draw(const char* pszTitle, bool* bDraw)
//-----------------------------------------------------------------------------
// Purpose: draws the compmenu
//-----------------------------------------------------------------------------
void IBrowser::CompMenu(void)
void CBrowser::CompMenu(void)
{
ImGui::BeginTabBar("CompMenu");
if (ImGui::TabItemButton("Server Browser"))
@ -146,7 +146,7 @@ void IBrowser::CompMenu(void)
//-----------------------------------------------------------------------------
// Purpose: draws the server browser section
//-----------------------------------------------------------------------------
void IBrowser::ServerBrowserSection(void)
void CBrowser::ServerBrowserSection(void)
{
ImGui::BeginGroup();
m_imServerBrowserFilter.Draw();
@ -240,7 +240,7 @@ void IBrowser::ServerBrowserSection(void)
//-----------------------------------------------------------------------------
// Purpose: refreshes the server browser list with available servers
//-----------------------------------------------------------------------------
void IBrowser::RefreshServerList(void)
void CBrowser::RefreshServerList(void)
{
static bool bThreadLocked = false;
@ -264,7 +264,7 @@ void IBrowser::RefreshServerList(void)
//-----------------------------------------------------------------------------
// Purpose: get server list from pylon.
//-----------------------------------------------------------------------------
void IBrowser::GetServerList(void)
void CBrowser::GetServerList(void)
{
m_vServerList.clear();
m_svServerListMessage.clear();
@ -274,7 +274,7 @@ void IBrowser::GetServerList(void)
//-----------------------------------------------------------------------------
// Purpose: connects to specified server
//-----------------------------------------------------------------------------
void IBrowser::ConnectToServer(const string& svIp, const string& svPort, const string& svNetKey)
void CBrowser::ConnectToServer(const string& svIp, const string& svPort, const string& svNetKey)
{
if (!svNetKey.empty())
{
@ -289,7 +289,7 @@ void IBrowser::ConnectToServer(const string& svIp, const string& svPort, const s
//-----------------------------------------------------------------------------
// Purpose: connects to specified server
//-----------------------------------------------------------------------------
void IBrowser::ConnectToServer(const string& svServer, const string& svNetKey)
void CBrowser::ConnectToServer(const string& svServer, const string& svNetKey)
{
if (!svNetKey.empty())
{
@ -304,7 +304,7 @@ void IBrowser::ConnectToServer(const string& svServer, const string& svNetKey)
//-----------------------------------------------------------------------------
// Purpose: Launch server with given parameters
//-----------------------------------------------------------------------------
void IBrowser::LaunchServer(void)
void CBrowser::LaunchServer(void)
{
#ifndef CLIENT_DLL
DevMsg(eDLL_T::ENGINE, "Starting server with name: \"%s\" map: \"%s\" playlist: \"%s\"\n", m_Server.svServerName.c_str(), m_Server.svMapName.c_str(), m_Server.svPlaylist.c_str());
@ -330,7 +330,7 @@ void IBrowser::LaunchServer(void)
//-----------------------------------------------------------------------------
// Purpose: draws the hidden private server modal
//-----------------------------------------------------------------------------
void IBrowser::HiddenServersModal(void)
void CBrowser::HiddenServersModal(void)
{
bool modalOpen = true;
if (ImGui::BeginPopupModal("Connect to Private Server", &modalOpen))
@ -396,7 +396,7 @@ void IBrowser::HiddenServersModal(void)
//-----------------------------------------------------------------------------
// Purpose: draws the host section
//-----------------------------------------------------------------------------
void IBrowser::HostServerSection(void)
void CBrowser::HostServerSection(void)
{
#ifndef CLIENT_DLL
static string svServerNameErr = "";
@ -548,7 +548,7 @@ void IBrowser::HostServerSection(void)
//-----------------------------------------------------------------------------
// Purpose: updates the hoster's status
//-----------------------------------------------------------------------------
void IBrowser::UpdateHostingStatus(void)
void CBrowser::UpdateHostingStatus(void)
{
#ifndef CLIENT_DLL
if (!g_pHostState || !g_pCVar)
@ -602,7 +602,7 @@ void IBrowser::UpdateHostingStatus(void)
//-----------------------------------------------------------------------------
// Purpose: sends the hosting POST request to the comp server
//-----------------------------------------------------------------------------
void IBrowser::SendHostingPostRequest(void)
void CBrowser::SendHostingPostRequest(void)
{
#ifndef CLIENT_DLL
m_svHostToken.clear();
@ -644,7 +644,7 @@ void IBrowser::SendHostingPostRequest(void)
//-----------------------------------------------------------------------------
// Purpose: executes submitted commands in a separate thread
//-----------------------------------------------------------------------------
void IBrowser::ProcessCommand(const char* pszCommand)
void CBrowser::ProcessCommand(const char* pszCommand)
{
std::thread t(CEngineClient_CommandExecute, this, pszCommand);
t.detach(); // Detach from render thread.
@ -656,7 +656,7 @@ void IBrowser::ProcessCommand(const char* pszCommand)
//-----------------------------------------------------------------------------
// Purpose: draws the settings section
//-----------------------------------------------------------------------------
void IBrowser::SettingsSection(void)
void CBrowser::SettingsSection(void)
{
ImGui::InputTextWithHint("Hostname", "Matchmaking Server String", &m_szMatchmakingHostName);
if (ImGui::Button("Update Hostname"))
@ -678,7 +678,7 @@ void IBrowser::SettingsSection(void)
//-----------------------------------------------------------------------------
// Purpose: regenerates encryption key
//-----------------------------------------------------------------------------
void IBrowser::RegenerateEncryptionKey(void) const
void CBrowser::RegenerateEncryptionKey(void) const
{
NET_GenerateKey();
}
@ -686,7 +686,7 @@ void IBrowser::RegenerateEncryptionKey(void) const
//-----------------------------------------------------------------------------
// Purpose: changes encryption key to specified one
//-----------------------------------------------------------------------------
void IBrowser::ChangeEncryptionKeyTo(const string& svNetKey) const
void CBrowser::ChangeEncryptionKeyTo(const string& svNetKey) const
{
NET_SetKey(svNetKey);
}
@ -694,7 +694,7 @@ void IBrowser::ChangeEncryptionKeyTo(const string& svNetKey) const
//-----------------------------------------------------------------------------
// Purpose: sets the browser front-end style
//-----------------------------------------------------------------------------
void IBrowser::SetStyleVar(void)
void CBrowser::SetStyleVar(void)
{
ImGuiStyle& style = ImGui::GetStyle();
ImVec4* colors = style.Colors;
@ -807,4 +807,4 @@ void IBrowser::SetStyleVar(void)
style.WindowMinSize = ImVec2(750, 510);
}
IBrowser* g_pIBrowser = new IBrowser();
CBrowser* g_pBrowser = new CBrowser();

View File

@ -25,7 +25,7 @@ enum class EServerVisibility
PUBLIC
};
class IBrowser
class CBrowser
{
private:
bool m_bInitialized = false;
@ -42,8 +42,8 @@ public:
////////////////////
// Funcs //
////////////////////
IBrowser(void);
~IBrowser(void);
CBrowser(void);
~CBrowser(void);
void Draw(const char* pszTitle, bool* bDraw);
void CompMenu(void);
@ -112,5 +112,5 @@ public:
}
};
extern IBrowser* g_pIBrowser;
extern CBrowser* g_pBrowser;
#endif

View File

@ -117,7 +117,7 @@ namespace VSquirrel
SQRESULT GetServerName(HSQUIRRELVM v)
{
int iServerIndex = sq_getinteger(v, 1);
std::string svServerName = g_pIBrowser->m_vServerList[iServerIndex].svServerName;
std::string svServerName = g_pBrowser->m_vServerList[iServerIndex].svServerName;
sq_pushstring(v, svServerName.c_str(), -1);
@ -130,7 +130,7 @@ namespace VSquirrel
SQRESULT GetServerPlaylist(HSQUIRRELVM v)
{
int iServerIndex = sq_getinteger(v, 1);
std::string svServerPlaylist = g_pIBrowser->m_vServerList[iServerIndex].svPlaylist;
std::string svServerPlaylist = g_pBrowser->m_vServerList[iServerIndex].svPlaylist;
sq_pushstring(v, svServerPlaylist.c_str(), -1);
@ -143,7 +143,7 @@ namespace VSquirrel
SQRESULT GetServerMap(HSQUIRRELVM v)
{
int iServerIndex = sq_getinteger(v, 1);
std::string svServerMapName = g_pIBrowser->m_vServerList[iServerIndex].svMapName;
std::string svServerMapName = g_pBrowser->m_vServerList[iServerIndex].svMapName;
sq_pushstring(v, svServerMapName.c_str(), -1);
@ -155,9 +155,9 @@ namespace VSquirrel
//-----------------------------------------------------------------------------
SQRESULT GetServerCount(HSQUIRRELVM v)
{
g_pIBrowser->GetServerList(); // Refresh svListing list.
g_pBrowser->GetServerList(); // Refresh svListing list.
sq_pushinteger(v, g_pIBrowser->m_vServerList.size());
sq_pushinteger(v, g_pBrowser->m_vServerList.size());
return SQ_OK;
}
@ -233,7 +233,7 @@ namespace VSquirrel
int iServerIndex = sq_getinteger(v, 1);
// !TODO: Create glue class instead.
g_pIBrowser->ConnectToServer(g_pIBrowser->m_vServerList[iServerIndex].svIpAddress, g_pIBrowser->m_vServerList[iServerIndex].svPort, g_pIBrowser->m_vServerList[iServerIndex].svEncryptionKey);
g_pBrowser->ConnectToServer(g_pBrowser->m_vServerList[iServerIndex].svIpAddress, g_pBrowser->m_vServerList[iServerIndex].svPort, g_pBrowser->m_vServerList[iServerIndex].svEncryptionKey);
return SQ_OK;
}
@ -252,13 +252,13 @@ namespace VSquirrel
return SQ_OK;
// Adjust browser settings.
g_pIBrowser->m_Server.svPlaylist = svServerPlaylist;
g_pIBrowser->m_Server.svMapName = svServerMapName;
g_pIBrowser->m_Server.svServerName = svServerName;
g_pIBrowser->eServerVisibility = eServerVisibility;
g_pBrowser->m_Server.svPlaylist = svServerPlaylist;
g_pBrowser->m_Server.svMapName = svServerMapName;
g_pBrowser->m_Server.svServerName = svServerName;
g_pBrowser->eServerVisibility = eServerVisibility;
// Launch server.
g_pIBrowser->LaunchServer();
g_pBrowser->LaunchServer();
return SQ_OK;
}
@ -276,7 +276,7 @@ namespace VSquirrel
bool result = g_pR5net->GetServerByToken(svListing, svHiddenServerRequestMessage, svToken); // Send szToken connect request.
if (result)
{
g_pIBrowser->ConnectToServer(svListing.svIpAddress, svListing.svPort, svListing.svEncryptionKey);
g_pBrowser->ConnectToServer(svListing.svIpAddress, svListing.svPort, svListing.svEncryptionKey);
}
return SQ_OK;
@ -324,7 +324,7 @@ namespace VSquirrel
DevMsg(eDLL_T::UI, "Connecting to server with ip-address '%s' and encryption key '%s'\n", svIpAddr.c_str(), svEncKey.c_str());
g_pIBrowser->ConnectToServer(svIpAddr, svEncKey);
g_pBrowser->ConnectToServer(svIpAddr, svEncKey);
return SQ_OK;
}

View File

@ -186,7 +186,7 @@ void ImGui_ImplWin32_Shutdown()
static bool ImGui_ImplWin32_UpdateMouseCursor()
{
// These have to be here to prevent the mouse in-game from flickering when '::SetCursor(...)' is called.
if (g_pIBrowser->m_bActivate || g_pIConsole->m_bActivate)
if (g_pBrowser->m_bActivate || g_pIConsole->m_bActivate)
{
ImGuiIO& io = ImGui::GetIO();
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)

View File

@ -60,7 +60,7 @@ ServerBrowser_Invoke_f
*/
void ServerBrowser_Invoke_f(const CCommand& args)
{
g_pIBrowser->m_bActivate = !g_pIBrowser->m_bActivate;
g_pBrowser->m_bActivate = !g_pBrowser->m_bActivate;
}
#endif // !DEDICATED

View File

@ -73,11 +73,11 @@ LRESULT CALLBACK HwndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (wParam == g_pImGuiConfig->IBrowser_Config.m_nBind0 || wParam == g_pImGuiConfig->IBrowser_Config.m_nBind1)
{
g_pIBrowser->m_bActivate = !g_pIBrowser->m_bActivate;
g_pBrowser->m_bActivate = !g_pBrowser->m_bActivate;
}
}
if (g_pIConsole->m_bActivate || g_pIBrowser->m_bActivate)
if (g_pIConsole->m_bActivate || g_pBrowser->m_bActivate)
{//////////////////////////////////////////////////////////////////////////////
g_bBlockInput = true;
@ -273,17 +273,17 @@ void DrawImGui()
ImGui::NewFrame();
if (g_pIBrowser->m_bActivate)
if (g_pBrowser->m_bActivate)
{
g_pInputSystem->EnableInput(false); // Disable input to game when browser is drawn.
g_pIBrowser->Draw("Server Browser", &g_pIBrowser->m_bActivate);
g_pBrowser->Draw("Server Browser", &g_pBrowser->m_bActivate);
}
if (g_pIConsole->m_bActivate)
{
g_pInputSystem->EnableInput(false); // Disable input to game when console is drawn.
g_pIConsole->Draw("Console", &g_pIConsole->m_bActivate);
}
if (!g_pIConsole->m_bActivate && !g_pIBrowser->m_bActivate)
if (!g_pIConsole->m_bActivate && !g_pBrowser->m_bActivate)
{
g_pInputSystem->EnableInput(true); // Enable input to game when both are not drawn.
}
@ -370,7 +370,7 @@ HRESULT GetDeviceAndCtxFromSwapchain(IDXGISwapChain* pSwapChain, ID3D11Device**
HRESULT __stdcall GetResizeBuffers(IDXGISwapChain* pSwapChain, UINT nBufferCount, UINT nWidth, UINT nHeight, DXGI_FORMAT dxFormat, UINT nSwapChainFlags)
{
g_pIConsole->m_bActivate = false;
g_pIBrowser->m_bActivate = false;
g_pBrowser->m_bActivate = false;
g_bInitialized = false;
g_bPresentHooked = false;