Use 'g_pServer->IsActive()' over 'g_pHostState->m_bActiveGame'

This commit is contained in:
Kawe Mazidjatari 2022-08-28 17:40:03 +02:00
parent a9aded7fd8
commit 0b49ea1f29
3 changed files with 11 additions and 6 deletions

View File

@ -445,7 +445,7 @@ void CBrowser::HostPanel(void)
ImGui::Spacing();
ImGui::Separator();
if (!g_pHostState->m_bActiveGame)
if (!g_pServer->IsActive())
{
if (ImGui::Button("Start Server", ImVec2((ImGui::GetWindowSize().x - 10), 32)))
{
@ -499,7 +499,7 @@ void CBrowser::HostPanel(void)
ImGui::InputText("##ServerHost_HostToken", &m_svHostToken, ImGuiInputTextFlags_ReadOnly);
}
if (g_pHostState->m_bActiveGame)
if (g_pServer->IsActive())
{
if (ImGui::Button("Weapon Reparse", ImVec2((ImGui::GetWindowSize().x - 10), 32)))
{
@ -556,7 +556,7 @@ void CBrowser::UpdateHostingStatus(void)
}
std::lock_guard<std::mutex> l(g_pServerListManager->m_Mutex);
g_pServerListManager->m_HostingStatus = g_pHostState->m_bActiveGame ? EHostStatus_t::HOSTING : EHostStatus_t::NOT_HOSTING; // Are we hosting a server?
g_pServerListManager->m_HostingStatus = g_pServer->IsActive() ? EHostStatus_t::HOSTING : EHostStatus_t::NOT_HOSTING; // Are we hosting a server?
switch (g_pServerListManager->m_HostingStatus)
{

View File

@ -13,6 +13,9 @@
#include "tier1/cvar.h"
#include "engine/net.h"
#include "engine/host_state.h"
#ifndef CLIENT_DLL
#include "engine/server/server.h"
#endif // !CLIENT_DLL
#include "vpc/keyvalues.h"
#include "pylon.h"
#include "listmanager.h"
@ -76,7 +79,7 @@ void CServerListManager::LaunchServer(void) const
KeyValues::ParsePlaylists(m_Server.m_svPlaylist.c_str());
mp_gamemode->SetValue(m_Server.m_svPlaylist.c_str());
if (g_pHostState->m_bActiveGame)
if (g_pServer->IsActive())
{
ProcessCommand(fmt::format("{:s} \"{:s}\"", "changelevel", m_Server.m_svHostMap).c_str());
}

View File

@ -7,8 +7,10 @@
#include <core/stdafx.h>
#include <tier1/cvar.h>
#include <engine/host_state.h>
#include <networksystem/pylon.h>
#ifndef CLIENT_DLL
#include <engine/server/server.h>
#endif // !CLIENT_DLL
//-----------------------------------------------------------------------------
// Purpose: Send keep alive request to Pylon Master Server.
@ -17,7 +19,7 @@
bool KeepAliveToPylon(const NetGameServer_t& netGameServer)
{
#ifndef CLIENT_DLL
if (g_pHostState->m_bActiveGame && sv_pylonVisibility->GetBool()) // Check for active game.
if (g_pServer->IsActive() && sv_pylonVisibility->GetBool()) // Check for active game.
{
string m_szHostToken;
string m_szHostRequestMessage;